title: PHP string compare and search in a multiple table column
body: <p>its my first post and I have a problem with a PHP search.</p>
  
  <p>Here, </p>
  
  <pre><code>$searchq = $_POST['searchq'];
  </code></pre>
  
  <p>so far when a single word is supplied for searchq like naresh, google, lamgade then it search in a db but when there is a multiple search like</p>
  
  <p><code>naresh lamgade</code> at a same time then there is error for these word because it only search in a first_name column and what i want  to search naresh in a <code>first_name</code> column and lamgade in a <code>last_name</code> column</p>
  
  <p>Here is the code</p>
  
  <pre><code>&lt;pre&gt; $searchq = $_POST['searchq'];
  
   $conn = mysqli_connect('localhost','root','','std_info') or die("Cant' Connect to db");
  
   $query = mysqli_query($conn,"select * from student_details  where first_name like '%$searchq%' or last_name like '%$searchq%'");
  
   $count = mysqli_num_rows($query);    
  
   if($count == 0) {
  
           echo "&lt;br&gt;";
           echo "Can't find, try entering only first name or last name";
  
    }    
    else {
           do something`&lt;/pre&gt;
     }
  </code></pre>
  
  <p>The problem is </p>
  
  <p>In a search bar, when i try entering naresh lamgade and search then
   <pre>searchq =naresh+lamgade</pre></p>
  
  <p>and it search in both first_name and last_name column with a <code>naresh+lamgade</code> so there is no result. </p>
  
  <p>I want to know , how to break these two words and search in a different column with these words.</p>