Jump to content

Recommended Posts

I am attempting to customize a paging script I found on a tutorial.

 

The script works wonderfully, except that it counts the TOTAL number of records in the table.  I would like to be able to count the "current" number of records, which can be determined by the URL.

 

For example... if the page was "index.php", there might be 1200 records in the table all total.  At 100 records per page, there are going to be "paging" links for 12 pages.  But if I filtered the results (index.php?instrument=flute") for example, I want the paging to handle just the, let's say, 200 flute records in the table, not all 1200.  With only 200 results for flutes (or whatever), it should show links for only 2 pages.

 

/////////////// WE have to find out the number of records in our table. We will use this to break the pages///////
$query2=" SELECT * FROM mytablename ";
$result2=mysql_query($query2);
echo mysql_error();
$nume=mysql_num_rows($result2);
/////// The variable nume above will store the total number of records in the table////
?>

 

Thank you.

 

~Wayne

Link to comment
https://forums.phpfreaks.com/topic/115131-solved-counting-current-number-of-rows/
Share on other sites

Thank you.

 

The problem is that there are several dozen types of instruments that can be "filtered" from the table.  I also may need to filter it by a different column (other than instrument) as well.  Is there a way to do it without hard coding it?

 

~Wayne

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.