Jump to content

Mysql_fetch _array help.. total number rows vs. output


arpowers

Recommended Posts

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 in the table 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:

 

$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;
}

 

so what I want from this one query is enough to get this info..

I want to:

1. get a total number of users affiliated (e.g. you have 22 users affiliated)

2. only output a certain lower number for output to page. (e.g. user1 - user2 - user3- user4 etc...)

 

Thanks!~

 

Suggestions?

Back to top

View user's profile Send private message

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.