示例:
<?php
#连接数据库
$link=mysqli_connect("localhost","root","root");
#选择数据库
$link->select_db("rorely") or die("could not find database");
#查询数据库
$result=$link->query("select * from test");
#输出数据库表各个记录的内容
while($row=mysqli_fetch_object($result)){
echo $row->id." ".$row->name." ".$row->age." ".$row->sex." ".$row->address."<hr>";
}
#关闭数据库
mysqli_close($link);
?>
1 Jane 26 female wenming cun 123#
3 Tome 21 male wenming cun 32#
4 Lily 25 female wenming cun 2#
5 Lucy 25 female wenming cun 2#
6 Jim 22 male wenmin cun 45#
7 Jim 22 male wenmin cun 45#
8 Jim 22 male wenmin cun 45#
9 Jim 22 male wenmin cun 45#
10 Jim 22 male wenmin cun 45#
11 Jim 22 male wenmin cun 45#
12 Jim 22 male wenmin cun 45#
13 Jniu 22 female address
14 Jim 22 male wenmin cun 45#
15 Jim 22 male wenmin cun 45#
18 Jim 22 male wenmin cun 45#
20 Jim 22 male wenmin cun 45#
78 lili 22 female wenming cun 23#
79 hj 30 male wenming cun 23#
80 hj 30 male wenming cun 23#
posted on 2009-07-02 15:37
期待明天 阅读(222)
评论(0) 编辑 收藏 所属分类:
PHP