php - 在 PHP 中使用 Mysql 时出现错误 500

标签 php mysql http-error

有人可以向我解释一下我的代码有什么问题吗?当我尝试访问该页面时,它只是给我一个 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/

相关文章:

php - 基于带字母的整数创建一个 ID

PHP MySQL While 循环 多个表

php - JSON + Jquery Ajax + PHP + MYSQL 出错

mysql - 未知/不支持的存储引擎 : InnoDB

php - 运行第二个循环时取消设置数据

python - HTTP错误 : HTTP Error 503: Service Unavailable goslate language detection request : Python

php - 运行一个查询并快速找出一个结果 w/a 之前的行数?

mysql - 返回 SUM 零(0)而不是 null

c# - 使用 JSON 响应测试 WCF

Angular HttpClient : How to get raw HTTP response, 即使出错