think_php跨库操作失败

浏览:590 发布日期:2015/11/26 分类:求助交流 关键字: 跨库
define('THINK_VERSION', '3.0RC2');

命令行模式

$connectTalk = "mysql://cxlusr:[email protected]:3306/talk";
$connectMt = "mysql://root:[email protected]:3306/maintenance";

$User = M('User','talk_',$connectTalk);
$User1 = M('User','m_',$connectMt);
echo $User->max('id');
echo $User->getLastSql();
echo $User1->max('id');
echo $User1->getLastSql();

后台输出
10SELECT MAX(id) AS tp_max FROM `talk_user` LIMIT 1 10SELECT MAX(id) AS tp_max FROM `talk_user` LIMIT 1

为啥sql和结果都一样,我的写法有问题吗

换成
$User = new Model('User','talk_',$connectTalk);
$User1 = new Model('User','m_',$connectMt);
sql倒是打印正确了,不过第二个结果查不到

要怎么操作才可以呢?
最佳答案
评论( 相关
后面还有条评论,点击查看>>