> From: Cesare D'Amico [mailto:[EMAIL PROTECTED]
> 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't
> >
> > now 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 returned
> >
> > if 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 didn’t 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 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.

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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to