From 849a0a0c7dde9a31243c0b8fc87bb8f88b567f7a Mon Sep 17 00:00:00 2001 From: Camille Lafitte Date: Thu, 19 May 2011 13:45:54 +0000 Subject: [PATCH] =?UTF-8?q?Etre=20connect=C3=A9=20=C3=A0=20la=20bonne=20ba?= =?UTF-8?q?se=20lors=20d'une=20alternance=20de=20connexion=20mysql=20=20*?= =?UTF-8?q?=20Le=20mode=20persistant=20reaffecte=20uniquement=20une=20conn?= =?UTF-8?q?exion=20uniquement=20sur=20la=20base=20du=20login/mot=20de=20pa?= =?UTF-8?q?sse=20=20*=20Par=20cons=C3=A9quent=20:=20=20=20*=20la=20connexi?= =?UTF-8?q?on=20ne=20retient=20en=20memoire=20que=20la=20derniere=20base?= =?UTF-8?q?=20selectionn=C3=A9e=20=20=20*=20lorsqu'on=20alterne=20des=20re?= =?UTF-8?q?quetes=20sur=20du=20multibases,=20il=20est=20necessaire=20de=20?= =?UTF-8?q?v=C3=A9rifier=20la=20base=20selectionn=C3=A9e=20au=20pr=C3=A9al?= =?UTF-8?q?able?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/class/db_mysql.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bureau/class/db_mysql.php b/bureau/class/db_mysql.php index 54660010..19922326 100644 --- a/bureau/class/db_mysql.php +++ b/bureau/class/db_mysql.php @@ -100,6 +100,12 @@ class DB_Sql { return 0; } } + + //persistent connection don't conserve database selection + //if needed do a correct database selection + $db_connected = @mysql_fetch_array(@mysql_query("SELECT DATABASE();",$this->Link_ID)); + if ($db_connected[0] != $this->Database) + mysql_select_db($Database,$this->Link_ID); return $this->Link_ID; }