在我的网站中,我想列出我导入的数据库中的表。这是我的 php 代码:
$status=1;
$newsql = "select table_name from information_schema.tables where table_schema = '$dbname' order by create_time desc limit 1";
$dasql = mysql_query($newsql);
$danewsql = mysql_fetch_row($dasql);
if($danewsql)
{
$tblstr.=$danewsql[0].',';
sleep(1);
}
$tblstr = substr($tblstr,0,-1);
return $tblstr;
她的 $dbname 是数据库的名称。
当我显示$tblstr
它时,它的值为 0。
该站点正在我的系统中进行测试,然后我得到 $ 中的值tblstr
。但是当我在其他系统中检查它时,我得到了 0 值。我的代码有什么问题?
为什么信息shema取自本地服务器而不是客户端服务器?
这是mysql连接代码:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'test_user';
$db['default']['password'] = 'test';
$db['default']['database'] = 'db_test';
这是一个codeigniter网站。