php判断mysql数据表是否存在(源代码)

 蓝色智慧 发表于 2021年05月26日 网站建设  21
蓝色智慧
LV 7 [大学]
最后在线:30天前
加入时间:2年前
主帖:230  跟帖:5

$db=@mysqli_connect('localhost','root','password','database'); //链接数据库

$sql = "show tables like 'table'"; //查询table表格

$re = mysqli_query($db,$sql); //执行SQL

//判断表是否存在

if(mysqli_num_rows($re)){ 

echo "存在";

}else{

echo "不存在";

}

论坛主帖
231
论坛跟帖
2
在线访客
0
今日主帖
0
今日跟帖
0
今日注册
0
168
http://www.76w.net/sq/index.php/gentie.html
http://www.76w.net/sq/index.php/postzan.html
http://www.76w.net/sq/index.php/postcai.html
http://www.76w.net/sq/index.php/postshoucang.html
http://www.76w.net/sq/index.php/gentiezan.html
http://www.76w.net/sq/index.php/gentiecai.html
http://www.76w.net/sq/index.php/huifu.html
http://www.76w.net/sq/index.php/xiugai.html
http://www.76w.net/sq/index.php/shanchugentie.html
1
XzA=
1
© 2023 天慧网·互动社区 版权所有
Powered by JianYuLunTan
蒙ICP备2021000971号-1
http://www.76w.net/sq/index.php/feedback.html
http://www.76w.net/sq/index.php/qiandao.html
http://www.76w.net/sq/index.php/denglu.html
0
http://www.76w.net/sq/index.php/adenglu.html
剑鱼论坛