PHP 破坏了我的代码

PHP is breaking my code

我正在尝试部署一个站点,但是当 PHP/MySql 代码进入服务器时出现错误。它在开发中运行良好,但在生产中运行不佳。

我的代码到这里,没有任何问题:

<div class="content">
  <section class="col1">
   <h1>Read reviews or write us one</h1>
  </section>
  <section class="col2">
   <button type="button" class="read">Read Reviews</button>
    <?php include ('display.php'); ?>

然后当我检查源代码时,HTML 就停在那里了。我猜 display.php 文件中的 PHP 有问题,看起来像这样:

<?php
$con = mysql_connect('localhost','communi3_root',"password");
mysql_select_db('communi3_cfds','communi3@localhost',"password") or die(mysql_error());
$query = "select * from reviews";
$result = mysql_query($query)or die(mysql_error());
$row = mysql_fetch_array($result);

echo "<table class='displayReviews' border='1' style='width:100%;'>";
echo "<tr stlye='display:block;margin:0em auto;'><th>Name</th><th>Review</th><th>Date</th></tr>";

while ($row = mysql_fetch_array($result))
{
    echo "<tr><td>"; 
    echo $row['monicker'];
    echo "</td><td>";
    echo $row['review'];
    echo "</td><td>";
    echo $row['date'];
    echo "</td></tr>";
}
echo "</table>";
mysql_close();
?>

删除一些错误后

<?php
    $con = mysql_connect('localhost','communi3_root',"password");
    mysql_select_db('communi3_cfds',$con) or               die(mysql_error());
    $query = "select * from reviews";
    $result = mysql_query($query)or die(mysql_error());
    $row = mysql_fetch_array($result);
    echo "<table class='displayReviews' border='1' style='width:100%;'>";
    echo "<tr stlye='display:block;margin:0em auto;'><th>Name</th><th>Review</th><th>Date</th></tr>";
    while ($row = mysql_fetch_array($result))
    {
        echo "<tr><td>"; 
        echo $row['monicker'];
        echo "</td><td>";
        echo $row['review'];
        echo "</td><td>";
        echo $row['date'];
        echo "</td></tr>";
    }
    echo "</table>";
    mysql_close();
    ?>