页面源代码显示我的部分页面未显示


Page source reveals part of my page isn't displaying

我正在做一个朋友的项目,我负责设计一个简单的网站来连接他的数据库。我为他的一个页面编写了以下代码:

<!DOCTYPE html>
<html>
    <head>
        <title>Narcissus-OTS</title>
        <meta charset="utf-8" />
        <!--<meta http-equiv="refresh" content="3;url=./account.php" />-->
    </head>
    <body>
        <?php include("./common/database.php"); ?>
        <?php
            //Grabs user-submitted credentials from previous page
            $accountid = mysql_escape_string($_POST["acc"]);
            $password = mysql_escape_string($_POST["pass"]);
            $confirmation = mysql_escape_string($_POST["passtwo"]);
            //Insures there is no duplicate database entry for accountid
            $querycheck = $db->query("
                SELECT *
                    FROM accounts a
                    WHERE a.name = $accountid
                ");
            $checkifone = $querycheck->rowCount();
            //If no duplicate entry...
            if ($checkifone == 1) {
                echo "There is already an account with that name; please choose a different account number.";
            } else {
            //Confirms if passwords match
                if ($password == $confirmation) {
                    $passhash = sha1($password);
                    $database = $db->query("
                        INSERT INTO accounts
                            VALUES (NULL , '$accountid', '$passhash', '65535', '0', '', '1', '0', '0', '1');
                    ");
                    echo "Your account has been successfully created.";
                //If passwords do not match
                } else {
                    echo "Your passwords did not match, please try again.";
                }
            }
        ?>
    </body>
</html>         

当我加载页面并查看页面源代码时,它似乎没有显示终止</body>或终止</html>标签。我已经跟踪了我的代码,看不到任何缺少的分号或括号。对于我的生活,我无法弄清楚这一点。仅当密码不匹配时,它才会正确显示终止标记(最底部嵌套的 else 语句)。

编辑; 在任何人说出来之前,我知道mysql_escape_string已被弃用。

编辑2;数据库.php看起来像...

<?php
    $SERVER   = "localhost";
    $USERNAME = "redacted";
    $PASSWORD = "redacted";
    $DATABASE = "redacted";
    $db = new PDO("mysql:dbname={$DATABASE}; host={$SERVER}", $USERNAME, $PASSWORD);
    $db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
?>

解决此问题以及将来发生的任何其他类似事件的最佳方法是tail服务器日志并确定问题到底是什么。

对于apache2

tail -f /var/log/apache2/error.log

对于nginx

tail -f /var/log/nginx/error.log