LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MYSQL Question (https://www.linuxquestions.org/questions/linux-newbie-8/mysql-question-44725/)

stayathomemom 02-09-2003 05:52 PM

MYSQL Question
 
Just learning PHP & MYSQL and am getting an error message...

I'm typing an example right out of a textbook...I know my database 'books' is good but I'm curious if anyone sees the problem with this section of code.

mysql_select_db("books");
$query = "select * from books where ".$searchtype."
like '%".$searchterm."%' ";
$result = mysql_query($query);
$num_results = mysql_num_rows($result); (this is line 31)

echo "<p>Number of books found: ".$num_results."</p>";

ERROR MESSAGE I get:

Warning: Supplied argument is not a valid MySQL result resource in /www/htdocs/results.php on line 31

Thanks to anyone who takes time to look this over!


All times are GMT -5. The time now is 04:26 PM.