-2

i keep get this message every time i run this code can anyone help me figure this out. I am creating a simple search engine using php and phpMy admin here is the code for the connection on a separate page and my php for the search engine

<?php

   if(isset($_POST['submit'])){
    $search = $_POST['search_name'];



    if(!empty ($search)){


        $query ="SELECT * FROM Person WHERE LIKE Name LIKE '%".$search."%'";


        $result = $con->query($query);


        if(mysqli_num_rows($result)>=1){

            echo 'results found:';


            while($qr=mysqli_fetch_assoc($result)){


                echo $qr['Name'].'<br>';


            }

        }
          else {echo'no results found';}

     }else{}

   }

  ?>
Abhik Chakraborty
  • 43,914
  • 5
  • 48
  • 61
Martin
  • 3
  • 2
  • `LIKE Name` to just `Name` if u have a col name as `LIKE Name` then use it in backtics which is very unlikely to have – Abhik Chakraborty Mar 21 '14 at 13:41
  • 1
    If you search for error messages you see, you are highly likely to find a solution. That's a double win; less duplicate posts for us, and an instant answer for you. – halfer Mar 21 '14 at 13:43
  • probably there's an error in your query which returns `false` – ponciste Mar 21 '14 at 13:43

1 Answers1

0

there's an error in your query which returns false, try this instead

$query ="SELECT * FROM Person WHERE Name LIKE '%".$search."%'";
ponciste
  • 2,226
  • 12
  • 16