View Single Post
Old Mar 26th, 2008, 2:41 PM   #9
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,799
Rep Power: 5 Sane will become famous soon enough
Re: Simple PHP Search Script

Try printing out the variables and the query before sending them off. Verify that the query and related variables are sound and correct.

Also, I'm not sure but it could matter that you had an apostraphe directly after the word 'LIKE'.

Then finally, add a mysql_error() command to see what happened.

php Syntax (Toggle Plain Text)
  1. $qry = "SELECT * FROM users WHERE upper($field) LIKE '%$find%'";
  2. echo "Query: $qry<br />Field: $field<br />Find: $find<br />";
  3. $data = mysql_query($qry);
  4.  
  5. echo mysql_error();
Sane is offline   Reply With Quote