<?php // 认识其他mysqli其他函数
header( 'Content-Type:text/html;charset=utf-8 ');
require 'prepareSrarment.php';
$mysqli=new mysqli("localhost", "root", "root", "user1", 3306);
$mysqli->set_charset("utf8");
$sql="select *from user1";
$res=$mysqli->query( $sql);
echo $res->field_count;//列数
echo $res->num_rows;//行数
//从$res取出
echo "<table border='1px solid #fcc'><tr>";
while ($field=$res->fetch_field()){
echo "<th>{$field->name}</th>"; }
echo "</tr>";
echo "<tr>";
while ($row=$res->fetch_row())
{
foreach ( $row as $key=>$val)
{
echo "<td>{$val}</td>";
}
echo "</tr>";
} echo "</table>"; ?>