$link = mysql_connect ( 'localhost', 'root', 'root' )
mysql_select_db ( 'test', $link )
$sql = "select * from books "
$result = mysql_query ( $sql )
//将结果集转为数组,每次取一行
while($row = mysql_fetch_assoc($result)) {
$rows[] = $row
}
echo json_encode($rows)
exit
?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)