Jump to content

Mysql_fetch _array help.. total number rows vs. output


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.