Alle 00:18, giovedì 23 ottobre 2003, Lukas Smith ha scritto:
run query that works
run query that doesn'tnow when you fetch the rows of the first query you will usually
determine if you hit the end if the result set by checking if you
don't get an array returnedif you don't get an array you check for an error and in several ext
you will get the error created by the second query. This is also
caused by the fact that the error checking simply returns the last
error which cant be cleared appearently.
But can't you resolve this problem by checking if the query worked just
after issuing it? I mean, do something like:
. run query 1
. check if q1 worked
. run query 2
. check if q2 worked
. if q1 worked -> fetch data
...and so on.
Perhaps I'm missing something, but I can't see a real issue here.
--
Cesare D'Amico - http://www.phpday.it
"Eun'emergenza!!! Dovrei fare questo-e-questaltro ma non posso perche' la mia testa e piena di segatura e criceti!!!"
-- un utente [ http://www.soft-land.org/storie/ ]
From: Cesare D'Amico [mailto:cesare@ngi.it]
Sent: Thursday, October 23, 2003 2:59 PM
Alle 00:18, giovedì 23 ottobre 2003, Lukas Smith ha scritto:
run query that works
run query that doesn'tnow when you fetch the rows of the first query you will usually
determine if you hit the end if the result set by checking if you
don't get an array returnedif you don't get an array you check for an error and in several ext
you will get the error created by the second query. This is also
caused by the fact that the error checking simply returns the last
error which cant be cleared appearently.But can't you resolve this problem by checking if the query worked just
after issuing it? I mean, do something like:. run query 1
. check if q1 worked
. run query 2
. check if q2 worked
. if q1 worked -> fetch data...and so on.
Perhaps I'm missing something, but I can't see a real issue here.
Yeah, you are missing something :-/
mysql_error() will return you the last error over and over again.
So you find that q2 didnt work and you want to proceed then you will from
then on always get that failure from q2 until you produce a new error. This
is not the case in all ext but iirc atleast in mssql and sybase the problem
also seems to exist.
While I think about it: There would be one solution that wouldnt break BC:
adding a function that would clear the last error. Then you could manually
clear an error after you have read it.
The other alternative would be to remember the last error and check if that
error is the same every time you check and all such solutions are possible
but very hacky of course.
Regards,
Lukas
While I think about it: There would be one solution that wouldn't break
BC:
adding a function that would clear the last error. Then you could manually
clear an error after you have read it.
I could see that mysql_reset_error() would be useful. + 1!
Regards,
Manuzhai
At 03:02 PM 10/23/2003 +0200, Lukas Smith wrote:
mysql_error() will return you the last error over and over again.
Shouldn't the mysql extension clear the last error on a successful query?
Andi