Posted by vito on 06/22/06 05:55
after executing the query, say it returns 1000 results.
if i just want to do some sampling and like to have a look on 4 of them,
how can i refer to these 4 random records out of 1000? i'm working on
processing the result of $res_array which has 1000 records.
query = select * from test;
result = mysql_query(query);
records1000 = db_result_to_array($result);
//how to select/remove records1000 to get say, records4?
function db_result_to_array($result) {
$res_array = array();
for ($count=0; $row = $result->fetch_assoc(); $count++) {
$res_array[$count] = $row;
}
return $res_array;
}
[Back to original message]
|