开发者

Mysql select different database after connecting to one

So I'm trying to re-select a database, I have two databases, one for VB, one for a custom CMS. They're both connected, however I only store a small amount of user data on the CMS one and need to be able to retrieve the user information from VB table.

So heres the process,

  1. I have a 开发者_StackOverflow社区DB object already connected, and selected the CMS database
  2. I load up a function to get the user data
  3. I reselect the database via

    mysql_select_db("xxxx_xxxvb", $this->mysql_con);

  4. When I execute the function, it returns the data from the CMS's user table, and not VB

Anyone got any ideas why?

Thank you


try to open two connections

$con1 = mysql_connect('your', 'db', 'info');
$con2 = mysql_connect('your', 'db', 'info');

mysql_select_db("xxx_xxxcms", $con1);
mysql_select_db("xxx_xxxvb", $con2);

and see if it works. Don't forgot to use queries like

mysql_query("SELECT id FROM users WHERE username = 'user'", $con2);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜