PHP:从mysqli搜索

PHP:从mysqli搜索,php,search,mysqli,Php,Search,Mysqli,我有一个search.php页面,其中包含以下代码 <html> <body style="background-color: azure"> please import your search request: <br> <form method="get" action="searchprocess.php"> <input type="text" placeholder="please impor

我有一个search.php页面,其中包含以下代码

<html>
<body style="background-color: azure">
    please import your search request:
    <br>
    <form method="get" action="searchprocess.php">
        <input type="text" placeholder="please import here" name="search">
        <input type="submit">
    </form>
</body>
</html>
您使用了错误的var

while($row = mysqli_fetch_array($result)){
  $id = $result['id'];
  $firstname = $result['firstname'];
  $lastname = $result['lastname'];
应该是:

while($row = mysqli_fetch_array($result)){
  $id = $row['id'];
  $firstname = $row['firstname'];
  $lastname = $row['lastname'];

我鼓励您使用以避免SQL注入攻击。

错误是什么?签出并编辑您的问题。这对每个人都有帮助。这是一个简单的打字错误问题。
while($row = mysqli_fetch_array($result)){
  $id = $result['id'];
  $firstname = $result['firstname'];
  $lastname = $result['lastname'];
while($row = mysqli_fetch_array($result)){
  $id = $row['id'];
  $firstname = $row['firstname'];
  $lastname = $row['lastname'];