查找数据库中数据表。。。

来源:互联网 发布:黑马程序员的简历 编辑:程序博客网 时间:2024/05/18 03:17
查找数据库中某数据表是否存在。。。
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>意见与建议。。。|ComeSome社区</title><style></style><script></script></head><body><?php$svr = "localhost";$usr = "root";$pwd = "";$con = mysql_connect("localhost","root","");//连接数据库$dbname = "suggest";$tbname = "msg";$create_table = "CREATE TABLE $tbname(usrname varchar(15),email varchar(20),message longtext)";if(mysql_select_db($dbname, $con)){//exists//$result = mysql_list_tables($dbname);//$row = mysql_fetch_row($result);//for()$result = mysql_query("show tables like 'msg'", $con);$row = mysql_fetch_row($result);if($tbname == $row[0]){echo $tbname." found!!!";}else{echo $tbname." not found!!!";}}else{echo $dbname." doesn't exist";}?></body></html>


msg found!!! 


0 0
原创粉丝点击