Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

SmartyPaginate

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
wjdennen
Smarty Rookie


Joined: 23 Oct 2004
Posts: 24

PostPosted: Thu Dec 16, 2004 4:19 am    Post subject: SmartyPaginate Reply with quote

Hi there-

I am trying to use SmartyPaginate to paginate a set of mysql results. I am also using ezsql to interact with the database.

The first page of results returns OK.

The bottom has the navigation links like:

[1-10] [11-20] [21-30] etc

When I click on [11-20] or any other one, the results are messed up. I think the query is getting messed up.

How does SmartyPaginate keep track of what the original query was?

Does the query have to be a GET?

Thanks-
Bill
Back to top
View user's profile Send private message
wjdennen
Smarty Rookie


Joined: 23 Oct 2004
Posts: 24

PostPosted: Thu Dec 16, 2004 4:28 am    Post subject: Reply with quote

I should clarify one point.

The user enters a search query and this is part of the sql query that goes against the database.

ie.

select * from table where somefield LIKE '%$query%';

When I click from on page of results to another, this query string seems to be getting lost.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 16, 2004 2:36 pm    Post subject: Reply with quote

SmartyPaginate does not keep track of the query, that is up to your application. It only keeps track of the LIMIT conditions of the query.
Back to top
View user's profile Send private message Visit poster's website
wjdennen
Smarty Rookie


Joined: 23 Oct 2004
Posts: 24

PostPosted: Thu Dec 16, 2004 3:48 pm    Post subject: Reply with quote

Thanks, this is what I feared. I have not found any examples on how to do this with mysql.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 16, 2004 4:01 pm    Post subject: Reply with quote

Which database you use really isn't part of the equation either. Your PHP application must remember the SQL query from page to page. This could be as simple as storing the query text in your php session, then retrieving it on each iteration tacking on the current LIMIT clause.
Back to top
View user's profile Send private message Visit poster's website
wjdennen
Smarty Rookie


Joined: 23 Oct 2004
Posts: 24

PostPosted: Thu Dec 16, 2004 5:39 pm    Post subject: Reply with quote

Thanks. Sorry -- I just meant that I could not find any good examples that directly apply (ie. database query). I understand the example that is included with SmartyPaginate. But, it's a bit simpler than what I need to do. That's all. Smile Thanks again.
Back to top
View user's profile Send private message
wjdennen
Smarty Rookie


Joined: 23 Oct 2004
Posts: 24

PostPosted: Thu Dec 16, 2004 6:28 pm    Post subject: Reply with quote

all set now! thanks!
works wonderfully.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 16, 2004 7:11 pm    Post subject: Reply with quote

A database example would be identical to the demo except instead of array_slice($foo, $x, $y) you would have something like "select * from foo limit $x, $y"
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP