我是靠谱客的博主 傲娇衬衫,这篇文章主要介绍查找数据库中数据表。。。,现在分享给大家,希望可以做个参考。

查找数据库中某数据表是否存在。。。

<!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!!! 


最后

以上就是傲娇衬衫最近收集整理的关于查找数据库中数据表。。。的全部内容,更多相关查找数据库中数据表内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部