php,$sql在使用$result之前返回空的$rows

php,$sql在使用$result之前返回空的$rows,php,Php,我是stackoverflow的新手,请不要催我:) 我已经为此挣扎了几天: <?php require_once "../../config.php"; $sql = "SELECT chestionar.participanti.id, chestionar.participanti.id_chestionar, chestionar.participanti.email, chestionar.participa

我是stackoverflow的新手,请不要催我:)

我已经为此挣扎了几天:

    <?php
                require_once "../../config.php";
                $sql = "SELECT chestionar.participanti.id, chestionar.participanti.id_chestionar, chestionar.participanti.email, chestionar.participanti.nume
FROM chestionar.participanti WHERE chestionar.participanti.email LIKE '$email' LIMIT 1";
                if ($result = mysqli_query($link, $sql)) {
                    if (mysqli_num_rows($result) > 0) {
                        echo "<table class='table table-bordered table-striped'>";
                        echo "<thead>";
                        echo "<tr>";
                        echo "<th>IDClient</th>";
                        echo "<th>IDChestionar</th>";
                        echo "<th>Adresa</th>";
                        echo "<th>Nume</th>";
                        echo "<th>Actiuni</th>";
                        echo "</tr>";
                        echo "</thead>";
                        echo "<tbody>";
                        while ($row = mysqli_fetch_array($result)) {
                            echo "<tr>";
                            echo "<td>" . $row['id'] . "</td>";
                            echo "<td>" . $row['id_chestionar'] . "</td>";
                            echo "<td>" . $row['email'] . "</td>";
                            echo "<td>" . $row['nume'] . "</td>";
                            echo "<td>";
                            echo "<a href='deletech.php?id=" . $row['id'] . "' title='Sterge Client' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
                            echo "</td>";
                            echo "</tr>";
                        }
                        echo "</tbody>";
                        echo "</table>";
                        mysqli_free_result($result);
                    } else {
                        echo "<p class='lead'><em>No client.</em></p>";
                    }
                } else {
                    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
                }

                mysqli_close($link);
                ?>

谢谢你的发帖人。
我发现问题在于所选列上的行为空/空。

一旦我删除了这些空行,问题就消失了。

在哪里可以定义$email?在HTML之前:if(isset($\u GET['search']){$email=mysqli\u real\u escape\u string($,htmlspecialchars($\u GET['search']);$id=mysqli\u real\u escape\u string($,htmlspecialchars($\u GET['search']))}谢谢您的关注。稍后我会将其更新为已准备好的声明。目前我使用.htaccess和order deny,allow deny from all allow from“LAN或一个IPPUBLIC”
<form action="" method="GET">
            <input type="text" placeholder="E-mail" name="search">&nbsp;
            <input type="submit" value="Search Client" name="btn" class="btn btn-sm btn-primary">
        </form>