[PHP-DB] result set in php pagination

[email protected] (Joe Keenan)
Newsgroups php.db
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.