Forum Moderators: coopster
I have no problem getting one row from the db with:
<?php printf(mysql_result($pResult,0,"UserID"));?>
I have tried to loop, but with no success, I did however manage to grind the server to a halt as my script produced and infinite loop :-).
Cheers
Richard
$result=mysql_query("SELECT * FROM sometable");
while($row=mysql_fetch_row($result)){
do_something_with_row();
}
This will automatically terminate when the last row has been processed.
The difference between mysql_fetch_row() and mysql_fetch_array() is that the first returns the results in a numeric array ($row[0], $row[1] etc), while the latter returns a the results an array containing both numeric and associative keys ($row["name"], $row["email"] etc). mysql_fetch_object() returns an object ($row->name, $row->email etc).