faqts : Computers : Programming : Languages : PHP : Common Problems : Arrays

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

How do I use PHP to step (one by one) through the records of MySQL database query result?

Oct 21st, 2006 03:09
Chad Currie, R H, http://www.blogvoid.com/category/php-programming/


$sql = "SELECT userid from tbl_users";
$res = mysql_query($sql);
while($row=mysql_fetch_array($res)){
 //Loop through all records returned
   echo $row["userid"];
}
The above code is an example of how to loop through all the records 
returned by a mysql query.