Re: Attempting to search a MySQL database from PHP not working

From: Date: Thu, 31 May 2007 19:38:53 +0000
Subject: Re: Attempting to search a MySQL database from PHP not working
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-255923@lists.php.net to get a copy of this message
On May 31, 2007, at 3:27 PM, Davi wrote:
Em Quinta 31 Maio 2007 16:25, Jason Pruim escreveu:
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) {
*/ $result=$result_row[0]; while($result_row = mysql_fetch_array($result) {
Worked perfectly after adding a closing ) Thanks for the tip!
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.
HTH -- Davi Vidal davividal@siscompar.com.br davividal@gmail.com -- "Religion, ideology, resources, land, spite, love or "just because"... No matter how pathetic the reason, it's enough to start a war. " -------------------------------------------------------- Por favor não faça top-posting, coloque a sua resposta abaixo desta linha. Please don't do top-posting, put your reply below the following line. --------------------------------------------------------


« previous php.general (#255923) next »