<?php
$link = Mysql_connect(“localhost”,”root”,”123”) or die(“数据库连接失败!”);
Mysql_select_db(“db_test”,$link) or die(“选择数据库失败!”);
$sql = “select id,name,age,gender,phone,email from friend where age>20”;
$result = mysql_query($sql);
$count = mysql_num_rows($result);
While($row = mysql_fetch_assoc($result)){
Echo $row[‘id’];
….
}