dongtanlin0765 2017-06-07 06:59
浏览 39
已采纳

为什么我的PHP代码没有显示在我的Web浏览器中? 它只是一个空白的白页

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>";
}
}

?>
  • 写回答

1条回答 默认 最新

  • dongshui9690 2017-06-07 07:06
    关注

    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';
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀