for ($count = 1; $row = $result->fetch_row(); ++$count) 这句话怎么解释?它是怎么循环的?function get_user_urls($username){//extract from the database all the URLs this user has stored$conn = db_connect();$result = $conn->query( "select bm
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 17:45:35
for ($count = 1; $row = $result->fetch_row(); ++$count) 这句话怎么解释?它是怎么循环的?function get_user_urls($username){//extract from the database all the URLs this user has stored$conn = db_connect();$result = $conn->query( "select bm
for ($count = 1; $row = $result->fetch_row(); ++$count) 这句话怎么解释?它是怎么循环的?
function get_user_urls($username)
{
//extract from the database all the URLs this user has stored
$conn = db_connect();
$result = $conn->query( "select bm_URL
from bookmark
where username = '$username'");
if $result)
return false;
//create an array of the URLs
$url_array = array();
for ($count = 1; $row = $result->fetch_row(); ++$count)
{
$url_array[$count] = $row[0];
}
return $url_array;
}
for ($count = 1; $row = $result->fetch_row(); ++$count) 这句话怎么解释?它是怎么循环的?
$count =1,为什么不是0,可以为0不?
for ($count = 1; $row = $result->fetch_row(); ++$count) 这句话怎么解释?它是怎么循环的?function get_user_urls($username){//extract from the database all the URLs this user has stored$conn = db_connect();$result = $conn->query( "select bm
fetch_row()函数的作用是:从结果集中取得一行作为数值型数组
获取数据之后,mysql_fetch_row()函数将移动到下一条记录;如果函数成功执行,它将获取一行信息(该行是通过执行mysql_query()函数取得的)并返回该行信息
所以循环从数据集中选出数据,存到指定位置,直到数据集中没有数据