//连接参数
$host="localhost";
$user="root";
$pwd="111111";
$db="test";
$linkID =mysql_connect($host,$user,$pwd); //创建一个mysql连接
if(!$linkID){
echo "unable to connect!";
}
mysql_select_db($db)or die("unable to select database"); //选择一个数据库
$SQL_SELECT_SYMBOLS="select * from symbols";
$result=mysql_query($SQL_SELECT_SYMBOLS)or die("error in query :$query. ".mysql_errno()); //执行SQL语句
if(mysql_num_rows($result)>0){
echo '
echo '
idcountryanimalcname';while($row=mysql_fetch_assoc($result)){
echo "
";echo "
".$row['id']."";echo "
".$row['country']."";echo "
".$row['animal']."";echo "
".$row['cname']."";echo "
";}
echo "
";}
else{
echo "记录未找到!";
}
mysql_free_result($result); //释放记录集所占用的内存
mysql_close($linkID); //关闭数据库连接
?>