if( $result = $mysqli->query($sql) ){
echo ' the number of the result is '.mysqli_num_rows($result)."<br>";
while ($row = $result->fetch_row()) {
printf ("%s/n", $row[0]);
}
}
本文介绍了一段使用PHP与MySQL进行数据库查询的代码示例。该示例展示了如何执行SQL查询并获取结果集,以及如何遍历并打印查询结果。
if( $result = $mysqli->query($sql) ){
echo ' the number of the result is '.mysqli_num_rows($result)."<br>";
while ($row = $result->fetch_row()) {
printf ("%s/n", $row[0]);
}
}

被折叠的 条评论
为什么被折叠?