简体   繁体   中英

Why is my PHP code not displaying in my web browser? it just appears as a blank white page

So I am trying to connect to my database and display the Vehicles on the web page. However it is just coming up with a blank page, and not displaying anything.

Below is the code for the page I was to display the contents of vehicles on from my database

Any Ideas?

<?php
   $conn = @mysqli_connect("localhost", "root", "2401", "taylor_callaghan_wca");

$query = "SELECT * FROM vehicle";
$results = mysqli_query($conn, $query);
if(!$results) {
echo ("Query error: " . mysqli_error($conn));
}

else {
// Fetch and display the results of the select query
while ($row = mysqli_fetch_array($results)) {
echo "<p>VIN_#: $row[vin]</p>";
echo "<p>Stock Number: $row[stockno]</p>";
echo "<p>Manufacturer Number: $row[man_num] </p>";
echo "<p>Model: $row[model] </p>";
echo "<p>Colour: Id $row[col_id] </p>";
echo "<p>Year: $row[year] </p>";
echo "<p>Price: $row[price] </p>";
echo "<p>Kilometres: $row[kms] </p>";
echo "<p>Registration: $row[rego] </p>";
echo "<p>Cylinders: $row[cylinders] </p>";
echo "<p>Fuel: $row[fuel] </p>";
echo "<p>Transmission: $row[transmission] </p>";
echo "<p>Category Id: $row[cat_id] </p>";
echo "<p>Vehicle On Special: $row[special] </p>";
echo "<p>Standard Used Vehicle: $row[standardusedvehicle] </p>";
}
}

?>

It's not really an answer but I can't post this code in comment. Try addind echos to see what it does and what it doesn't:

<?php
echo '1';
$conn = @mysqli_connect("localhost", "root", "2401", "taylor_callaghan_wca");

$query = "SELECT * FROM vehicle";
$results = mysqli_query($conn, $query);
if(!$results) {
    echo '2';
    echo ("Query error: " . mysqli_error($conn));
}

else {
    echo '3';
    // Fetch and display the results of the select query
    while ($row = mysqli_fetch_array($results)) {
        echo '4';
        echo "<p>VIN_#: $row[vin]</p>";
        echo "<p>Stock Number: $row[stockno]</p>";
        echo "<p>Manufacturer Number: $row[man_num] </p>";
        echo "<p>Model: $row[model] </p>";
        echo "<p>Colour: Id $row[col_id] </p>";
        echo "<p>Year: $row[year] </p>";
        echo "<p>Price: $row[price] </p>";
        echo "<p>Kilometres: $row[kms] </p>";
        echo "<p>Registration: $row[rego] </p>";
        echo "<p>Cylinders: $row[cylinders] </p>";
        echo "<p>Fuel: $row[fuel] </p>";
        echo "<p>Transmission: $row[transmission] </p>";
        echo "<p>Category Id: $row[cat_id] </p>";
        echo "<p>Vehicle On Special: $row[special] </p>";
        echo "<p>Standard Used Vehicle: $row[standardusedvehicle] </p>";
    }
}
echo '5';
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM