How can I make a search page in PHP so that searches not entirely accurate can

  • Thread starter Thread starter H
  • Start date Start date
H

H

Guest
still return hits? Hi, I am a PHP newbie, and I've tried this, but it doesn't work:

$result = mysql_query("SELECT * FROM book
WHERE BookID LIKE '$bookid' OR Author LIKE '$author' OR Title LIKE '$title' OR Qualification LIKE '$qual' OR (Subject LIKE '$subject' OR Subject LIKE '$other') OR Publisher LIKE '$publisher' OR ISBN LIKE '$isbn'");

This will only return the hits if the fields match exactly - so if only half of one of the fields is entered, it will not be found

Thanks
Thanks for your answer Daniel, but it doesn't work properly - if I put the '%' for both the author and the title, then it won't give proper results.
 
Back
Top