On Fri, 13 Feb 2004, Paul Miller wrote:
> I have always heard it was bad to store that much data in a session array?
>
> Can someone clarify this for me?
IMO It is bad to store lots of data in session variables.
The $_REQUEST var for the post/get should be enough.
URL: search.php?page=10
code:
$conf['maxresultsperpage'] = 10;
$ref = mysql_query("select count(*) as c from table where subject like '%foo%'");
list($cnt) = mysql_fetch_array($ref); // will assoc work here? dunno, didn't test
echo "Displaying ".($conf['maxresultsperpage']*$_REQUEST['page'])-9." through
".($conf['maxresultsperpage']*$_REQUEST['page']).".";
$ref = mysql_query("select subject, data from table where subject like '%foo%'
limit ".$conf['maxresultsperpage'].",
".($conf['maxresultsperpage']*$_REQUEST['page'])-10);
// loop through array returned from mysql
echo "<a href='url?page=".$_REQUEST['page']+1."'>Next</a>";
I think. It might need some tweaking, but you get the idea (I hope).
No need to store variables here.
Beckman
> -----Original Message-----
> From: Robert Twitty [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 13, 2004 12:34 PM
> To: Karen Resplendo
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Paging large recordsets
>
>
> Most of the PHP solutions I have seeen require the use of session
> variables. You could create an array containing only the unique
> identifiers of all the records, and then store it into a session
> variable. You would then use another session variable to retain the page
> size, and then include the page numbers in the "Next", "Prev", "First",
> "Last" and "Absolutr" page links. Printing is probably best done with
> dynamically generated PDF instead of HTML.
>
> -- bob
>
> On Fri, 13 Feb 2004, Karen Resplendo wrote:
>
> > I guess the time has come that my boss wants "Next", "Previous",
> > "First", "Last" paging for our data displays of large recordsets or
> > datasets.
> >
> > Any good solutons out there already? I have pieces of a few examples.
> >
> > Also, how to deal with printing? I would assume that the ideal page
> > size is not the ideal printed page size. oi vay!
> >
> > TIA
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing online
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Peter Beckman Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---------------------------------------------------------------------------
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php