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!
Error only on last row
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Error only on last row
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?
What's the code that you're using to loop through the result set?
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Error only on last row
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
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.
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
Try putting "or die(mysql_error());" after the query.....
Re: Error only on last row
But the error message doesn't appear now, is it going to make any effect now?
Should "or die…" be put on all querys?
Should "or die…" be put on all querys?
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Error only on last row
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
Thanks for the explanation aceconcepts.