fejl i min søge mskine
Hvad gør jeg forkert her i min søgemaskine?når jeg søger på et ord går det rigtig fint men når der er flere ord med mellemrum så går det galt.
her er fejlen. når når jeg har søgt på en to tre.
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/www/min side.dk/seek.php on line 70
Sorry, there are no matching result for en to tre .
Her er den kode jeg bruger.
$button = $_GET [ 'ord' ];
$search = $_GET [ 'ord' ];
if( !$button )
echo "you didn't submit a keyword";
else {
if( strlen( $search ) <= 1 )
echo "Search term too short";
else
{ echo "You searched for <b> $search </b> <hr size='1' > </ br > ";
$search_exploded = explode ( " ", $search );
$x = 0; foreach( $search_exploded as $search_each ) {
$x++; $construct = ""; if( $x == 1 )
$construct .="title LIKE '%$search_each%'";
else
$construct .="AND title LIKE '%$search_each%'";
}
$construct = " SELECT * FROM tags WHERE $construct ";
$run = mysql_query( $construct );
$foundnum = mysql_num_rows($run);
if ($foundnum == 0)
echo "Sorry, there are no matching result for <b> $search </b>. </br> </br> 1. Try more general words. for example: If you want to search 'how to create a website' then use general keyword like 'create' 'website' </br> 2. Try different words with similar meaning </br> 3. Please check your spelling";
else {
echo "$foundnum results found !<p>";
while( $runrows = mysql_fetch_assoc( $run ) ) {
$title = $runrows ['title'];
$desc = $runrows ['description'];
$id = $runrows ['id'];
echo "<a href='tags.php?manu=".$id."&".$title."' class='black'> <b> $title </b> </a> <br> <a href='tags.php?manu=".$id."&".$title."' class='gray'> tags.php?manu=".$id."&".$title." </a> <p>";
}
}
}
}
Jeg er også åben for andre forslag mv.
:D