Attempting to search a MySQL database from PHP not working
- From: japruim@xxxxxxxxxx (Jason Pruim)
- Date: Thu, 31 May 2007 15:25:19 -0400
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
.
- Follow-Ups:
- Re: [PHP] Attempting to search a MySQL database from PHP not working
- From: "Dave Goodchild"
- Re: [PHP] Attempting to search a MySQL database from PHP not working
- From: Robert Cummings
- Re: [PHP] Attempting to search a MySQL database from PHP not working
- From: Davi
- Re: [PHP] Attempting to search a MySQL database from PHP not working
- Prev by Date: 500 server error
- Next by Date: Re: [PHP] Attempting to search a MySQL database from PHP not working
- Previous by thread: 500 server error
- Next by thread: Re: [PHP] Attempting to search a MySQL database from PHP not working
- Index(es):