File size: 4,202 Bytes
0dff816 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
<?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();
}
?> |