Page 1 of 1
Error only on last row
Posted: Sat Aug 08, 2009 8:57 pm
by Stela
Hi…
I'm making a mysql_fetch_array and the results are all OK, the MySQL is all OK, but I receive this error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /htdocs/public/www/Site/PHP/PesquisasEventos.php on line 243
ONLY before the last row!
Can this be a problem on PHP? But if so, why I receive all the rows results OK?
Thanks!
Re: Error only on last row
Posted: Sun Aug 09, 2009 1:52 pm
by Mark Baker
If it was a bug in PHP itself, I'd have expected other people to have encountered it before now.
What's the code that you're using to loop through the result set?
Re: Error only on last row
Posted: Sun Aug 09, 2009 2:17 pm
by aceconcepts
When you receive a MySQL resource error it's due to an error with your query or query syntax. Double check your query or post more info.
Re: Error only on last row
Posted: Sun Aug 09, 2009 2:33 pm
by Stela
Weird, the message just stopped to appear.
I have sure that the MySQL was right, I tested it directly on PHPmyAdmin and it gave me the right result.
Here's one of the Querys
if ($searchJuntaFreguesia)
{
$query = mysql_query("SELECT tabClientes.* FROM tabConfirmacoes JOIN tabClientes ON (tabClientes.idCliente = tabConfirmacoes.idCliente) WHERE JuntaFreguesia='$searchJuntaFreguesia' AND tabConfirmacoes.idEvento = '$searchIdEvento' ");
functQuery($query);
}
I'm using this Loop
function functQuery($goQuery)
{
while ($myrow = mysql_fetch_array($goQuery))
{
Thanks for the replies.
Re: Error only on last row
Posted: Sun Aug 09, 2009 2:36 pm
by jackpf
Try putting "or die(mysql_error());" after the query.....
Re: Error only on last row
Posted: Sun Aug 09, 2009 2:41 pm
by Stela
But the error message doesn't appear now, is it going to make any effect now?
Should "or die…" be put on all querys?
Re: Error only on last row
Posted: Sun Aug 09, 2009 5:03 pm
by aceconcepts
mysql_error() is an error reporting function that will return any MySQL errors if they exist regarding the query you use it on. During production these error reporting tools should be off unless you want all your users seeing techy messages.
Re: Error only on last row
Posted: Sun Aug 09, 2009 8:30 pm
by Stela
Thanks for the explanation aceconcepts.