I have recently taken to writing my queries like so:
PHP Code:
$sql = "SELECT essay_name
FROM essays_pc
WHERE essay_name like '$whereClause'";
$result = mysql_query($sql) or die ("<br>Database error X <br>$sql<br>");
...
The X in "Database error X" is just a sequential number I give to each mysql_query so that if the query fails I not only have the sql query used dispayed in the browser for debugging purposes, but I can quickly find the relevent query in my source code.
I suggest you do yourself a favour and print out the sql statements for debugging purposes. They make your syntax errors much more obvious. Also, you can then cut an paste the actual sql into the mysql client or phpMyAdmin and test it there as well.
That said, I can see one problem with the sql immediately:
"SELECT essay_name FROM essays_pc WHERE essay_name like '$whereClause'"
Lets say that there is one search word "foo".
$searchWords[0] = "title LIKE '%foo%'";
So the SQL ends up looking like:
SELECT essay_name
FROM essays_pc
WHERE essay_name
like 'title LIKE '%foo%''
I think
. Its easier if you can print out the actual sql into the browser for debugging
Bookmarks