In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Hi, > > I have been trying to understand how to write a simple code that will > let me limit the number of files view to 10 records, but I need to > under how php can look at a number of records and then caculates how > many pages it needs to show all records. Is there some sample code that > shows how to calculate and how to show limits 0,5 5,10 so on and so on....
If you mean the number of records from a database, rather than files which you first mention, all you need to do is use COUNT(*) to determine the number of records found, then use some simple arithmetic and possibly the modulus operator to determine how many pages would be needed to display the records x at a time. For example, you have 57 records and you want to display 10 at a time. You will need at least 57/10 pages, plus one if 57 modulus 10 != 0. And the modulus operator in php is % Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php