Re: [PHPLIB] Multiple database problems From: Alec Effrat (alec <email protected>)
Date: 11/11/99

Eric,
    Here is an alternate solution. Use the database name in your SQL
statements. I haven't tried this but:
      "SELECT * FROM [databasename.]tablename;"
      "INSERT INTO [databasename.]tablename;"

    Here are some example queries:
      SELECT uid, userid FROM baselib.auth_user WHERE userid LIKE "a%";
      REPLACE INTO baselib.auth_user (uid,userid)
VALUES('something','anything');
      SELECT id, description FROM data.inventory WHERE id BETWEEN 10 AND 20;

      Where as baselib and data are my two databases.

    Please let me know if this helps any,
    Alec Effrat
    Alec <email protected>

Eric Thelin wrote:

> I have 3 seperate databses on one machine that all have the same
> username and password. The session handling code in phplib7.2 and older
> does not work in this situation. The problem it that persistent
> connections are handled based on host, username and password only. This
> allows a situation where the session table is not in the database
> currently select by select_db. The best solution that I can see to this
> sould be to modify all accesses to the session table from
> '$this->database_table' to '$this->database.".".$this->database_table'.
> This works for MySQL at least but I don't know if it will work on other
> platforms. If not there should be a select_db function just before each
> access to that table. If there both of these sections are rejected
> please at least add this to a FAQ somewhere so that people know the
> pitfalls of using the same username and password on multiple databases.
>
> Eric
>
> -
> 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.

-
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.