搜索了很多,然后就得到了下面的干货:
<?php
$server = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'db';
$conn = mysql_connect($server,$user,$pass);
if(!$conn) die("数据库系统连接失败!");
mysql_select_db($dbname) or die("数据库连接失败!");
$result = mysql_query("SHOW TABLES");
while($row = mysql_fetch_array($result))
{
$c_table_name = $row[0];
//echo "<br>".$c_table_name."<br>";
$query = "desc ".$row[0];
$result2 = mysql_query($query);
while($row2=mysql_fetch_assoc($result2)){
foreach ($row2 as $nnn=>$vvv){
if(($nnn == 'Field') && ($vvv == 'look_for_id')){
echo "<br>",$c_table_name,"!!!!!!!!!!";
echo "{",$nnn,"=";
echo "",$vvv,"}";
echo "<br>";
}
}
//print_r($row2);
}
}
mysql_free_result($result);
?>