I was following a tutorial and i copied word by word i don't know why i get the error.
Error >> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/*****/public_html/download/url/search.php on line 36
<?php
$results = $_GET['results'];
$terms = explode(" ", $results);
$query = "SELECT * FROM search WHERE keywords='$term1'";
foreach ($terms as $each) {
$i++;
if ($i == 1)
$query .= "keywords LIKE '%$each%' ";
else
$query .= "OR keywords LIKE '%$each%' ";
}
// connect
mysql_connect("localhost", "irnm_tutadmin", "731995");
mysql_select_db("irnm_tutorials");
$query = mysql_query($query);
$numrows = mysql_num_rows($query);
if ($numrows > 0) {
while ($row = mysql_fetch_assoc($query)){
$id = $row['id'];
$title = $row['title'];
$description = $row['description'];
$keywords = $row['keywords'];
$link = $row['link'];
echo "<h2><a href='$link'>$title</a></h2>
$description<br /><br />";
}
}
else
echo "No results found for \"<b>$results</b>\"";
// disconnect
mysql_close();
?>