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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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) {

> 	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@xxxxxxxxxxxxxxxx
davividal@xxxxxxxxx
--
"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.
--------------------------------------------------------

Attachment: pgpzDNjmUqb9w.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux