Ask a Question related to PHP Development, Design and Development.
-
Tony Marston #1
Re: Web Page Display W/Multiple Pages - Using mysql_num_rows($php_resultID);
Ralph Freshour <ralph@primemail.com> wrote in message news:<s478lv87b57ro1q1gu6jcp4mnbnj3pl5lf@4ax.com>. ..
Check out the LIMIT clause in MySQL. This enables you to construct a> I've built a query that will return more rows than I want to fit onto
> one web page - I'm using a var to hold the table row count:
>
> $php_row_count = mysql_num_rows($php_resultID);
>
> I'm planning to use a for loop to control how many rows to display on
> one web page but can I use:
>
> mysql_fetch_object($php_resultID)
>
> with a for loop?
>
> If I've fetched 80 rows for example, I want to be able to display 20
> rows per web page so I'll have 4 hot links on the bottom of each page:
>
> 1 2 3 4
>
> that I can click on to get that number's group of 20 rows
>
> Does this scheme make sense or does someone have another design scheme
> for handling multiple web page displays?
>
> Thanks...
SELECT statement that says "give me X rows starting from row Y" which
is equivalent to breaking down the table contents into separate
"pages". All you need to do is request a particular page number and
calculate the offset using code similar to the following:-
$numrows is obtained by doing "SELECT count(*) FROM ..."
$rows_per_page contains the page size (e.g 10 or 15 or whatever)
$pageno is the requested page number
// calculate highest possible page
$lastpage = ceil($numrows/$rows_per_page);
// build LIMIT string to append to SELECT statement
$limit_str = 'LIMIT ' .($pageno - 1) * $rows_per_page .','
..$rows_per_page;
Easy peasy lemon squeezy
Tony (is there no beginning to this man's talents) Marston
[url]http://www.tonymarston.net/[/url]
Tony Marston Guest
-
OSX10.4:IDCS2 - pages palette - page icon display
using the default IDCS2 palette settings: When viewing the 'pages' palette, the page icons are falling off the right edge of the palette. For... -
Printing multiple pages on one page
I would like to be able to print out four pages (or more) of a lengthy document on one page, thereby printing out the document in at least one fourth... -
Bad Page order when inserting multiple Pages
When I use the Insert Page function (Document>Pages>Insert) and select multiple pages to insert, they do not insert into the document in the order... -
How to display multiple records per page?
How can i build the easiest way an script which enables me to display an x amount of records per page? Friendly greetings, André -
[PHP] Display Records in Multiple Pages help please !
a sample from my db class, i had to store the total in a session as calling the total on every page on a large database was painful doing count(*)...



Reply With Quote

