//连接参数
$host="localhost";
$user="root";
$pwd="111111";
$db="test";
$mysqli =new mysqli($host,$user,$pwd,$db); //实例化一个mysqli对象,并打开一个连接
if(mysqli_connect_errno()){ //检查是否可以正确打开数据库
echo "unable to connect!";
}
$SQL_SELECT_SYMBOLS="select * from symbols";
if($result=$mysqli->query($SQL_SELECT_SYMBOLS)){
if($result->num_rows>0){
echo '
echo '
idcountryanimalcname';while($arr=$result->fetch_array()){
echo "
";echo "
".$arr[0]."";echo "
".$arr[1]."";echo "
".$arr[2]."";echo "
".$arr[3]."";echo "
";}
echo "
";}
else{
echo "记录未找到!";
}
$result->close(); //释放记录集所占用的内存
}
else{
echo "error in query:$query.".$mysqli->error;
}
$mysqli->close(); //关闭数据库连接
?>