mysql_fetch_array()函数从结果集中取得一行作为关联数组,或数字数组,或二者兼有返回根据从结果集取得的行生成的数组,如果没有更多行则返回 false。
while($rows=mysql_fetch_array($result)){
.............
}
注意一定不要把$rows=mysql_fetch_array($result)写在while外面,如果这样写:
rows=mysqlfetcharray(result);
while($rows){
…….
}
会造成死循环,因为$rows恒成立,相当于:
while(true){
……..
}
“`
mysql_fetch_assoc()与mysql_fetch_array()功能完全一样,只不过mysql_fetch_assoc()是从结果集中取出一行以关联数组的形式返回。在实际开发中推荐使用mysql_fetch_assoc()。