我是靠谱客的博主 傲娇衬衫,最近开发中收集的这篇文章主要介绍查找数据库中数据表。。。,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

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


最后

以上就是傲娇衬衫为你收集整理的查找数据库中数据表。。。的全部内容,希望文章能够帮你解决查找数据库中数据表。。。所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部