Hi, I’ve been trying to create a search function that calls to my phpmyadmin database but when I do I get this error on my website
“Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a7526299/public_html/SearchResult.php on line 158”
Here is the code to my website
Search Engine
' />Search Results
<?php $k = $_GET['k']; $terms = explode (" ", $k); $query = "SELECT * FROM Products WHERE "; foreach ($terms as $each) { $i++; if ($i == 1) $query .="keywords LIKE '%each%' "; else $query .="OR keywords LIKE '%each%' "; } // connect mysql_connect ("_____", "______", "___"); mysql_select_db("Products"); $query = mysql_query ($query); $numrows = mysql_num_rows($query); if ($numbers > 0) { while ($row = mysql_fetch_assoc($query)) { $id= $row['id']; $id= $row['Brand']; $id= $row['Description']; $id= $row['Category']; $id= $row['Price']; $id= $row['Image']; echo "$id, $Brand $Description, $Category, $Price, $Image"; } } else echo "No results found for $k"; // disconnect mysql_close(); ?>Any ideas?