Php 在表中可以看到开始标记em

Php 在表中可以看到开始标记em,php,html,Php,Html,我正在编写php代码,在尝试执行HTM5验证程序时看到了这个错误。但问题是我的整个档案里没有。有什么建议吗?这里怎么了 Error Line 27, Column 4: Start tag em seen in table. <em><br /> 错误行27,第4列:开始标记em见表。 编辑说明:我很少想在这里添加此代码,因为它很长,与错误无关(如我上面所说,html中没有标记) 你错过了一些} 因此,这应该是可行的: <section> &l

我正在编写php代码,在尝试执行HTM5验证程序时看到了这个错误。但问题是我的整个档案里没有。有什么建议吗?这里怎么了

Error Line 27, Column 4: Start tag em seen in table.
<em><br />
错误行27,第4列:开始标记em见表。

编辑说明:我很少想在这里添加此代码,因为它很长,与错误无关(如我上面所说,html中没有标记)



你错过了一些
}

因此,这应该是可行的:

<section>
    <table>

    <?php
        include("./settings.php");

        $conn = @mysqli_connect($host, $user, $pwd, $sql_db);

        if (!$conn) {
            echo "<p>Databse connection error</p>";
            exit;
        }

        $eoinumber = trim($_POST["num"]);
        $lname = trim($_POST["lname"]);

        $query = "SELECT * FROM eoi WHERE EOInumber = $eoinumber AND lname = '$lname'";
        $result = mysqli_query($conn,$query);

        if (!$result) {
            echo "<p>There is something wrong with the $query</p>";
            exit;
        } else {
            $temp = mysqli_num_rows($result);
        }

        if ($temp == 0) { ?>
            <p>0 enquiry found. Please check again your EOInumber and last name</p>
        <?php } else { ?>
            <thead>
                <tr>
                    <th>EOI number</th>
                    <th>Job ID</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Date of Birth</th>
                    <th>Gender</th>
                    <th>Street</th>
                    <th>Town</th>
                    <th>State</th>
                    <th>Postcode</th>
                    <th>Mail</th>
                    <th>Telephone</th>
                    <th>Skills</th>
                    <th>Other Skills</th>
                </tr>
            </thead>

            <?php
            while ($row = mysqli_fetch_assoc($result)) {
                echo "<tbody>";
                echo "<tr>";
                echo "<td>",$row["EOInumber"],"</td>";
                echo "<td>",$row["job_num"],"</td>";
                echo "<td>",$row["fname"],"</td>";
                echo "<td>",$row["lname"],"</td>";
                echo "<td>",$row["bday"],"</td>";
                echo "<td>",$row["gender"],"</td>";
                echo "<td>",$row["street"],"</td>";
                echo "<td>",$row["town"],"</td>";
                echo "<td>",$row["state"],"</td>";
                echo "<td>",$row["postcode"],"</td>";
                echo "<td>",$row["mail"],"</td>";
                echo "<td>",$row["tele"],"</td>";
                echo "<td>",$row["skill"],"</td>";
                echo "<td>",$row["other"],"</td>";
                echo "</tr>";
                echo "</tbody>";
                // echo "<p>Sucess</p>";
            }

        }


                ?>
    </table>
<!--...-->


无论是否存在
标记,您都会遇到问题,因为您正在打开表标记,然后可能将
或其他元素直接放入其中,这是非法的(您可以将
元素放在
中)。如果在检查查询是否成功运行后打开表会更好,即:

<section>
        <?php
            include("./settings.php");

            $conn = @mysqli_connect($host, $user, $pwd, $sql_db);

            if (!$conn) {
                echo "<p>Databse connection error</p>";
            } else {
                $eoinumber = trim($_POST["num"]);
                $lname = trim($_POST["lname"]);

                $query = "SELECT * FROM eoi WHERE EOInumber = $eoinumber AND lname = '$lname'";

                $result = mysqli_query($conn,$query);
                if (!$result) {
                    echo "<p>There is something wrong with the $query</p>";
                } else {
                    $temp = mysqli_num_rows($result);
                    if ($temp == 0) {
                       echo "<p>0 enquiry found. Please check again your EOInumber and last name</p>";
                    } else {
                    echo "<table>";
                    ... echo the table header...
                    while ($row = mysqli_fetch_assoc($result)) {
                    ... echo table results...
                    }
                    echo "</table>";
                }
            } 
      ?>


请添加您的html。哦,这不是问题。表结束于此,但在此之后还有更多的php代码:)@TreeNguyen啊,好的;)那么第27行是哪一行呢?那是:)非常感谢!我以前的态度是怎样的。这与我的代码有很大关系。再次感谢!我非常感激!
<section>
        <?php
            include("./settings.php");

            $conn = @mysqli_connect($host, $user, $pwd, $sql_db);

            if (!$conn) {
                echo "<p>Databse connection error</p>";
            } else {
                $eoinumber = trim($_POST["num"]);
                $lname = trim($_POST["lname"]);

                $query = "SELECT * FROM eoi WHERE EOInumber = $eoinumber AND lname = '$lname'";

                $result = mysqli_query($conn,$query);
                if (!$result) {
                    echo "<p>There is something wrong with the $query</p>";
                } else {
                    $temp = mysqli_num_rows($result);
                    if ($temp == 0) {
                       echo "<p>0 enquiry found. Please check again your EOInumber and last name</p>";
                    } else {
                    echo "<table>";
                    ... echo the table header...
                    while ($row = mysqli_fetch_assoc($result)) {
                    ... echo table results...
                    }
                    echo "</table>";
                }
            } 
      ?>