Attempting to search a MySQL database from PHP not working
| From: | Jason Pruim | Date: | Thu, 31 May 2007 19:25:19 +0000 |
| Subject: | Attempting to search a MySQL database from PHP not working | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-255918@lists.php.net to get a copy of this message | ||
Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on.
Here is the code I am using to display the results of the search:
echo ('<table border="1">');
echo "<tr><th>First Name</th><th>Author</th><th>Pages</th></tr>";
$result_row[] = mysql_query($query) or die(mysql_error());
echo "Result_row dump: $result_row <BR>";
$num=mysql_numrows($result);
echo "Num dump: $num <BR>";
$i= 0;
while($i < $num) {
echo "<tr><td>";
echo $result_row[0] . '</td><td>';
echo $result_row[1] . '</td><td>';
echo $result_row[2] . '</td></tr>';
$i++;
}
echo ("</table>");
the problem is instead of printing out the actual results it prints out 6 fields that say: "Resource id #5"
the query I'm using is: SELECT FName, LName, Add1, Add2 FROM current WHERE FName like '%jason%' which works in MySQL
I can't find any errors in my log files to even give me a hint as to what is going on.
If someone could take a look I would greatly appreciate it.
Jason Pruim