有人可以向我解释一下我的代码有什么问题吗?当我尝试访问该页面时,它只是给我一个 HTTP 错误 500。这是代码。
<?php
$conn = new mysqli("localhost","user","pass","db");
if(!empty($_GET['Info']))
{
$Info = $_GET['Info'];
$sql = "SELECT * FROM `Judges` WHERE `id` EQUALS $Info";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($rows = $result->fetch_assoc())
{
$PictureFile = Null
if(empty($rows["PictureFile"]))
{
$PictureFile = "MissingPicture.png";
}
else
{
$PictureFile = $rows["PictureFile"];
}
echo '<div><img src="' . $PictureFile . '" style="width=100px;height=100px;"> <p>This Is Just A Test Message!</p></div>';
}
}
else
{
echo "<p style='text-align: center;'>Your Search Came Back With 0 Results :(</p>";
}
}
$conn->close();
?>
最佳答案
你忘记了;在此命令行之后
$PictureFile = Null
我无法测试该脚本,但它必须解决您的问题。
关于php - 在 PHP 中使用 Mysql 时出现错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44203614/