mysql_fetch_allrows()
October 29th, 2002For Brad.
Here is a PHP function that will grab all the rows from a mysql result identifier:
function mysql_fetch_allrows($res) {
while($data[] = mysql_fetch_assoc($res)) {
# nothing
}
return array_slice($data,0,-1);
}
Or, if you just want one field:
function mysql_fetch_field_allrows($res,$field) {
while($data = mysql_fetch_assoc($res)) {
$rtn[] = $data[$field];
}
return $rtn;
}




















Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks