|
Posted by Simon Stienen on 04/03/07 01:41
On 2007-04-02 16-29-44, Jerry Stuckle wrote:
> Your problem is you're reusing $db in your class. When you issue:
>
> $result = $db->query( $select );
>
> You have wiped out the recordset you're using in:
>
> while( $db->next_record() )
>
> If you're going to make another request, you need to use another object.
>
> A real good reason why you shouldn't use globals.
Actually, it's not the global variable that causes the problem, but the bad
design of the DB class. The problem would be the same if he passed the DB
object as a parameter to the ctor - however, if the DB class would be
capable of handling concurrent queries (most likely by letting ::query()
return a result object), the problem wouldn't occur even with a global
variable.
So - yes, the global variable is a desease... but not the one the symptom
is pointing to. :)
HTH
[Back to original message]
|