static-variables / jweb /1a /assets /sample_data.php
fellybikush's picture
Upload 99 files
0dff816 verified
raw
history blame
4.2 kB
<?php
// sample_data.php
require_once 'config.php';
try {
$pdo = getDBConnection();
// Insert sample vehicles
$vehicles = [
[
'name' => 'Nissan GT-R',
'model_year' => 2023,
'location' => 'Tokyo',
'description' => 'The legendary Godzilla with 565HP twin-turbo V6 engine.',
'price' => 112000.00,
'image_url' => 'http://static.photos/automotive/640x360/1',
'status' => 'new'
],
[
'name' => 'Toyota Supra',
'model_year' => 2023,
'location' => 'Osaka',
'description' => 'The iconic sports car returns with 382HP turbocharged inline-6.',
'price' => 52000.00,
'image_url' => 'http://static.photos/automotive/640x360/2',
'status' => 'used'
],
[
'name' => 'Honda NSX',
'model_year' => 2023,
'location' => 'Yokohama',
'description' => '573HP hybrid supercar with cutting-edge technology.',
'price' => 169000.00,
'image_url' => 'http://static.photos/automotive/640x360/3',
'status' => 'limited'
]
];
$stmt = $pdo->prepare("INSERT INTO vehicles (name, model_year, location, description, price, image_url, status) VALUES (?, ?, ?, ?, ?, ?, ?)");
foreach ($vehicles as $vehicle) {
$stmt->execute([
$vehicle['name'],
$vehicle['model_year'],
$vehicle['location'],
$vehicle['description'],
$vehicle['price'],
$vehicle['image_url'],
$vehicle['status']
]);
}
// Insert sample testimonials
$testimonials = [
[
'client_name' => 'Michael R.',
'client_photo' => 'http://static.photos/people/200x200/1',
'rating' => 5,
'content' => '"The team at Japanese Motors made importing my dream GT-R from Japan seamless. The car arrived in perfect condition, exactly as described. Their attention to detail is unmatched."',
'helpful_count' => 32
],
[
'client_name' => 'Sarah K.',
'client_photo' => 'http://static.photos/people/200x200/2',
'rating' => 5,
'content' => '"I was hesitant about importing a car internationally, but Japanese Motors guided me through every step. My Supra is flawless and I saved thousands compared to local dealers."',
'helpful_count' => 28
]
];
$stmt = $pdo->prepare("INSERT INTO testimonials (client_name, client_photo, rating, content, helpful_count) VALUES (?, ?, ?, ?, ?)");
foreach ($testimonials as $testimonial) {
$stmt->execute([
$testimonial['client_name'],
$testimonial['client_photo'],
$testimonial['rating'],
$testimonial['content'],
$testimonial['helpful_count']
]);
}
// Insert sample notifications
$notifications = [
[
'title' => 'Price drop on Nissan GT-R',
'message' => 'Special discount available this week only',
'type' => 'price_drop',
'icon' => 'dollar-sign'
],
[
'title' => 'New arrivals from Japan',
'message' => 'Fresh inventory just arrived from our Tokyo warehouse',
'type' => 'new_arrival',
'icon' => 'truck'
],
[
'title' => 'Limited time offer ending soon',
'message' => 'Don\'t miss our exclusive financing rates',
'type' => 'limited_offer',
'icon' => 'clock'
]
];
$stmt = $pdo->prepare("INSERT INTO notifications (title, message, type, icon) VALUES (?, ?, ?, ?)");
foreach ($notifications as $notification) {
$stmt->execute([
$notification['title'],
$notification['message'],
$notification['type'],
$notification['icon']
]);
}
echo "Sample data inserted successfully!";
} catch(PDOException $e) {
echo "Error inserting sample data: " . $e->getMessage();
}
?>