I'm trying to do a full text search to a MySQL database and have a problem
being able to read the results:

here is my code:
---------------------------
$query = "SELECT name,title,branch,section_one,section_two,MATCH
(section_header,section_one,section_two,section_footer) AGAINST
('".$searchCriteria."') AS score FROM pages WHERE MATCH
(section_header,section_one,section_two,section_footer) AGAINST
('".$searchCriteria."' IN BOOLEAN MODE) HAVING score > 0.2 ORDER BY score
DESC;";
 $results = mysql_query($query, $database) or die(mysql_error());
 $num_rows = mysql_num_rows($results);

 for($i=0;$i<$num_rows;$i++)
 {
  $row = mysql_fetch_object( $results);
   $body = substr($row->section_one, 0, 150);
  $results .= "<br><a
href=\"index.php?page=".$row->name."\">".$row->title."</a>
(".$row->branch.")<br>".$body."<br><br>";
 }

Here is the results:
-----------------------
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result
resource in C:\Inetpub\wwwroot\ymca\index.php on line 19

Notices:
--------------------------------------------------
Line 19 = $row = mysql_fetch_object( $results);

$num_rows returns a value of 8;

The first row retrieved from the results list works and returns the row with
Resource id #3 prefixed to the prinouts.  After the first row all futher
retrievals fail.

Configuration:
--------------------------
I am using MySQL 4.0.12 and PHP 4.3.2



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to