代码语言:javascript复制
$host="localhost";
$username="root";
$password="";
$db="test2";
$conn=mysqli_connect($host,$username,$password);
if(!$conn){
echo "数据库连接失败";
exit;
}
mysqli_select_db($conn,$db);
mysqli_query($conn,"SET NAMES UTF8");
echo "<div class='content'>";
echo "<table border=1 cellspacing=0 width=30% align=center>";
echo "<tr><td>ID</td><td>NAME</td></tr>";
echo "</table>";
echo "</div>";
mysqli_free_result($result);
先链接数据库看看是否能链接成功,成功的话,就然后是看先写好头下面的请看分页4