PHP中使用mysqli连接数据库例子

";

if ($result = mysqli_query($link, 'SELECT id,class,scores  FROM jian_scores WHERE scores>60 ')) {

echo('id  班级 分数 '). "
"; /* Fetch the results of the query 返回查询的结果 */ while( $row = mysqli_fetch_assoc($result) ){ echo $row['id'], " ", $row['class'], " ", $row['scores'], "
"; // printf("%s (%s) ", $row['id'],$row['class'], $row['scores']); } /* Destroy the result set and free the memory used for it 结束查询释放内存 */ mysqli_free_result($result); } /* Close the connection 关闭连接*/ mysqli_close($link); ?>

你可能感兴趣的:(PHP)