您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php判断表是否存在的方法_PHP

2025/5/12 14:39:51发布17次查看
本文实例讲述了php判断表是否存在的方法。分享给大家供大家参考。具体如下:
<?php//方法一 mysql_connect('localhost','root','2260375') or die('can\'t not connect database'); if((int)check_table_is_exist('show databases;','test')==1) { echo '该表存在'; } else { echo '该表不存在'; } function check_table_is_exist($sql,$find_table) { $row=mysql_query($sql); $database=array(); $finddatabase=$find_table; while ($result=mysql_fetch_array($row,mysql_assoc)) { $database[]=$result['database']; } unset($result,$row); mysql_close(); /*开始判断表是否存在*/ if(in_array($find_table,$database)) { return true; } else { return false; } }//////////////////////////////////////////////方法二 mysql_connect('localhost','root','root'); $result = mysql_list_tables('database'); $i=0; while($i
希望本文所述对大家的php程序设计有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product