对于mysql可以
$rs = mysql_query("show tables like 'table_name'");
if(mysql_num_rows($rs) == 0) {
建表程序
}当然,并不是所有的数据库都提供这样的功能,即使提供,使用的方法也可能不同
一般的
@db_query("select * from table_name where 0") or 建表函数();
$rs = mysql_query("show tables like 'table_name'");
if(mysql_num_rows($rs) == 0) {
建表程序
}当然,并不是所有的数据库都提供这样的功能,即使提供,使用的方法也可能不同
一般的
@db_query("select * from table_name where 0") or 建表函数();
取数条件为假,不会取得任何记录而只是判断表是否存在。