Control of mysql_fetch_array
Posted: Thu Oct 18, 2007 6:50 pm
Hey!
here is my problem....
I am writing a script that needs to pull all users from a relational table. I would like to return the total number of users affiliated but I would also like to limit the array fetched to a suitable number to be displayed on the screen (say.. 6)..
so if I use
Whats the best way to control the amount of the total actually fetched? I would try and use LIMIT {$users_displayed} in my query but that trumps the total users affiliated question....
Suggestions?
here is my problem....
I am writing a script that needs to pull all users from a relational table. I would like to return the total number of users affiliated but I would also like to limit the array fetched to a suitable number to be displayed on the screen (say.. 6)..
so if I use
Code: Select all
$total_num = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
//this will get data for every user... i don't want to do that.
$data[] = $row;
}Suggestions?