Re: [PHPLIB] Problem with page_close... From: Manuel Hossfeld (lists <email protected>)
Date: 10/28/99

Hi,

> Now I try this:
> page_open("sess"=>"My_Session", "auth"=>"My_Auth");
>
> $data_db = new MY_DATA;
> $data_db->query(...);
>
> << HTML CONTENT >>
> page_close();
>
> Now page_close() gives me an MySql error. Saying that the DATABASE
> "MY_DATA" does not contain a table called "active_sessions". And yes,
> that is true. But I want it to use the active_sessions table in the
> "MY_AUTH" database. And that works fine as long as I don't mention
> MY_DATA anywhere.
>
> Any clues???

This error occurs because PHP reuses the database connection that is made in
your "MY_DATA" class. So the page_close call tries to write data to the wrong
database!

This has already been discussed earlier on this list. To quote Kristian:

---snip----
Solutions, in order of decreasing preference:
 
a) Use only a single database.
b) Use different (host, user, password) tuples for different
   database connections.
c) Patch PHPLIB to prefix a "use" command before each real
   database command.
---snip----

I hope this helps,

CU,
Manuel
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.