2012-08-10 64 views

回答

1

可以使用

array_search('system',$krb->query('show tables')->fetch())!==false; 
+0

Marvelous 。在6分钟内完美接触 – 2012-08-10 12:00:09

1
select 1 
from information_schema.tables 
where table_name = 'systems' 
limit 1 
+0

tabl_name或table_name的? – TigerTiger 2012-08-10 11:53:45

+3

...或者如果你想返回0,如果它不存在,你可以做'SELECT IF((SELECT 1 FROM information_schema.tables WHERE table_name ='systems')= 1,1,0)AS存在' – DaveRandom 2012-08-10 11:55:00

1
$db_tables = array_keys($pdo->query('show tables')->fetchAll (PDO::FETCH_GROUP)); 

if(in_array('myTable', $db_tables)) 
{ 
    print "myTable exist"; 
} 
+1

奇怪的是,这个页面上的所有其他方法并不适合我,但这个 – anastymous 2016-01-26 22:03:00

相关问题