/var/www/vhosts/m-auto.co/httpdocs
Edit: /var/www/vhosts/m-auto.co/httpdocs/debug_brands.php (2267B)
Debug Brands and Cars";
// Test 1: Check brands table
echo "
1. Brands in database:
";
$brands_result = $conn->query("SELECT id, name, logo FROM brands LIMIT 5");
while($brand = $brands_result->fetch_assoc()) {
echo "
";
echo "ID: " . $brand['id'] . "
";
echo "Name: " . htmlspecialchars($brand['name']) . "
";
echo "Logo: " . htmlspecialchars($brand['logo']) . "
";
if ($brand['logo']) {
$logo_path = "uploads/brands/" . $brand['logo'];
echo "Logo path: $logo_path
";
echo "File exists: " . (file_exists($logo_path) ? "YES" : "NO") . "
";
if (file_exists($logo_path)) {
echo "

";
}
}
echo "
";
}
// Test 2: Check cars table
echo "
2. Cars in database:
";
$cars_result = $conn->query("SELECT id, name, brand FROM cars LIMIT 3");
while($car = $cars_result->fetch_assoc()) {
echo "
";
echo "Car ID: " . $car['id'] . "
";
echo "Car Name: " . htmlspecialchars($car['name']) . "
";
echo "Car Brand: " . htmlspecialchars($car['brand']) . "
";
echo "
";
}
// Test 3: Test JOIN query
echo "
3. JOIN Query Test:
";
$join_result = $conn->query("SELECT c.id, c.name, c.brand, b.logo as brand_logo FROM cars c LEFT JOIN brands b ON c.brand = b.name LIMIT 3");
while($row = $join_result->fetch_assoc()) {
echo "
";
echo "Car: " . htmlspecialchars($row['name']) . "
";
echo "Brand: " . htmlspecialchars($row['brand']) . "
";
echo "Brand Logo: " . htmlspecialchars($row['brand_logo']) . "
";
if ($row['brand_logo']) {
$logo_path = "uploads/brands/" . $row['brand_logo'];
echo "Logo path: $logo_path
";
if (file_exists($logo_path)) {
echo "

";
}
}
echo "
";
}
$conn->close();
?>