//this is search.html
...
<form action="results.php" method="post">
Choose Search Type:<br>
<select name="searchtype">
<option value="author">Author
<option value="title">Title
<option value="isbn">ISBN
</select><br>
Enter Search Term:<br>
<input name="searchterm" type=text>
<br>
<input type=submit value="Search">
...
is the searchterm & searchtype capable to transfer to the following result.php
//result.php
<?
trim($searchterm);
if (!$searchtype || !$searchterm)
{
echo "You have not entered search";
exit;
}
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
$db = mysql_connect("localhost", "mmu", "mmu4midc");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("books");
$query = "select * from books where $searchtype Like
'%".$searchterm."%'";
$result = mysql_query($query);
if (!mysql_num_rows($result)==0){
while($row = mysql_fetch_array($result)){
....
else
{
echo "No result";
}
mysql_free_result($result);
?>
- some problem occur when i try to run it.
mysql_num_rows(): supplied argument is not a valid MySQL result resource, no results
Where is the erroe, can somebody plz tell me, i have try for half day. but still same error occur.