Hi, need some help with the a php code i made to a search engine, i get a error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/eoopoedt/public_html/sok/search.php on line 49
Can some one fiks my code, and give me the right code:
<?php
$button = $_GET['submit'];
$search = $_GET['search'];
if (!$button)
echo "Søket samsvarer ikke med noen dokumenter. <br>
Prøv igjen senere.";
else
{
if (strlen($search) <=0)
echo "Søket samsvarer ikke med noen dokumenter. <br>
Prøv igjen senere.";
else
{
echo "søkeordet ditt: <b>$search</b> <hr size = '1'>";
mysql_connect("localhost","eoopoedt","200152007w");
mysql_select_db("eoop");
$search_exploded = explode (" ",$search);
foreach($search_exploded as $search_each)
{
$x++;
if ($x=1)
$construct .="keywords AND url AND title LIKE '%$search_each%'";
else
$constuct .= "OR keywords AND url AND title LIKE'%$search%'";
}
$constryct = "SELECT * FROM søkemotor WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum == 0)
echo "Ingen treff på søkeordet ditt.";
else
{
echo "$foundnum resultater funnet på søkeordet ditt";
while ($runrows = mysql_fetch_assoc($run))
{
$title = $runrows['title'];
$desc = $runrows ['description'];
$url = $runrows ['url'];
echo "
<b>$title</b><br>
$desc<br>
<a herf ='$url'>$url</a><p>";
}
}
}
}
?>