Originally posted by devinemke
the point is you do not need the loop to do this.
$sql= mysql_query("SELECT * WHERE MATCH (wname,title,keywords,description,city,country,category,url) AGAINST ('" . $_POST['search'] . "') FROM directory", $db);
[/B]
Understood. So this is what I tried but it came back with these errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/deep1/public_html/search_results.php on line 234
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/deep1/public_html/search_results.php on line 243
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/deep1/public_html/search_results.php on line 264
--- >BEGIN FULL TEXT
<?
include("inc/db.inc.php");
if(isset($POST['search']) && !empty($POST['search'])) {
mysql_connect() or die ("Problem connecting to Database");
$search = trim($_POST['search']);
$sql= mysql_query("SELECT * WHERE MATCH (wname,title,keywords,description,city,country,cat
egory,url) AGAINST ('" . $_POST['search'] . "') FROM directory", $db);
[LINE 234] $num_rows = mysql_num_rows($sql); // Number of search results
if ($search)
{
mysql_connect() or die ("Problem connecting to Database");
echo "<b> Found <u>".$num_rows."</u> results to match search string: ".$search."</b><br><br>";
echo "<table width=100% border=0 cellpadding=0 cellspacing=5 class=border_playlist_table><tr>";
$counter = 0;
[LINE 243] while ($myrow = mysql_fetch_array($sql)){
$wname = $myrow["wname"];
$url = $myrow["url"];
$title = $myrow["title"];
$city = $myrow["city"];
$country = $myrow["country"];
$category = $myrow["category"];
$keywords = $myrow["keywords"];
$description = $myrow["description"];
echo "<tr class=sub_1><td colspan=4>".++$counter." $wname : $category</td></tr>
<tr bgcolor=#55556F>
<td><p><a href=$url target=_blank>$url</a></p></td>
<td><p>$city</p></td>
<td><p>$country</p></td></tr>
<tr bgcolor=#55556F><td colspan=4>$keywords</td></tr>
<tr bgcolor=#55556F><td colspan=4>$description</td></tr>
<tr><td colspan=4> </td></tr>";
}
[LINE 264] mysql_free_result ($sql); // end while
echo "</tr></table>";
} else { echo "problems...."; }
} else {
echo " Search form is empty. Go back and type a new search.<br><br> <a href=\"javascript:history.go(-1);\">(click here to try again.)</a>";
}
?>
<--------- END