错误500在Php中使用Mysql

时间:2017-05-26 14:04:59

标签: 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();
?>

3 个答案:

答案 0 :(得分:0)

>>> A = np.array([[1,1,1,1,1,1,1,0],[1,1,1,1,1,0,0,0],[1,0,0,0,0,1,0,0],[1,0,0,1,0,0,1,0]]) >>> x = np.array([1,0,1,0,1,0,1,0]) >>> A.dot(x)%2 array([0, 1, 1, 0])

的末尾添加;

答案 1 :(得分:0)

你忘记了;在此命令行之后

$PictureFile = Null

我无法测试脚本,但它必须解决您的问题。

答案 2 :(得分:0)

将EQUALS更改为=并添加;在$ PictureFile = Null之后

    <?php
$conn = new mysqli("localhost","user","pass","db");
if(!empty($_GET['Info']))
{
    $Info = $_GET['Info'];
    $sql = "SELECT * FROM `Judges` WHERE `id`= $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();
?>
相关问题