Re: result set in php pagination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The easiest thing to do is either

A) store the author name in a session for the duration of the searches

B) add the name to the pagination url so that its passed along withe
the page number



On 1/23/10, Joe Keenan <heresiarch@xxxxxxxxxxxxxxx> wrote:
> I am using php and mysql.
>
> The problem which I am hoping someone can help me with concerns
> pagination of the result set of a search of a single table.
>
> I got the pagination script I am using from a Sitepoint tutorial and
> it works just as it should for this query
>
> "SELECT article_id, category_name, author_name, title,
> article_caption, date_format(magazine_date, '%M, %Y') as newdate FROM
> articles where article_id > 0 ORDER BY magazine_date DESC LIMIT
> $offset, $rowsperpage"
>
> The result set is return over many pages with no problem at all.
>
> When it comes to this next query however it delivers the first page of
> results and sets up the linked pages but those are empty.
>
> "SELECT article_id, author_name, category_name, title,
> article_caption, date_format(magazine_date, '%M, %Y') as newdate FROM
> articles WHERE author_name = '$author_name' ORDER BY magazine_date ASC
> LIMIT $offset, $rowsperpage"
>
> I assume the problem must have to do with '$author_name' which is
> passed to the search script as '$author_name = $_POST["author_name"];'
> from a php form.
>
> Is there something I should be doing to ensure that the result set
> from the query persists though the change in pagination from the first
> page of results to the second page.
>
> In both cases the search scripts are includes in other php pages.
>
> I think I need to understand how the result set is carried through or
> reacquired in the pagination process.
>
> Sorry if this is phrased very clumsily.
>
> Thank you,
>
> Joe Keenan
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
Sent from my mobile device


Bastien

Cat, the other other white meat

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux