欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php獲取mysql數(shù)據(jù)庫中的所有表名的代碼

 更新時間:2011年04月23日 22:56:47   作者:  
如何用PHP獲取MYSQL數(shù)據(jù)庫的所有表名?記得在mysql命令行下面有條命令SHOW TABLES是顯示mysql數(shù)據(jù)庫里面所有數(shù)據(jù)表的,那么就用這條命令來遍歷數(shù)據(jù)表名吧
復(fù)制代碼 代碼如下:

$server = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'dayanmei_com';
$conn = mysql_connect($server,$user,$pass);
if(!$conn) die("數(shù)據(jù)庫系統(tǒng)連接失敗!");
mysql_select_db($dbname) or die("數(shù)據(jù)庫連接失?。?);
$result = mysql_query("SHOW TABLES");
while($row = mysql_fetch_array($result))
{
echo $row[0]."";
}
mysql_free_result($result);

注意php中列表mysql中所有表名的函數(shù)mysql_list_tables,已經(jīng)刪除了,建議不要使用該函數(shù)列表mysql數(shù)據(jù)表

相關(guān)文章

最新評論