View previous topic :: View next topic |
Author |
Message |
wjdennen Smarty Rookie
Joined: 23 Oct 2004 Posts: 24
|
Posted: Thu Dec 16, 2004 4:19 am Post subject: SmartyPaginate |
|
|
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 |
|
wjdennen Smarty Rookie
Joined: 23 Oct 2004 Posts: 24
|
Posted: Thu Dec 16, 2004 4:28 am Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Dec 16, 2004 2:36 pm Post subject: |
|
|
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 |
|
wjdennen Smarty Rookie
Joined: 23 Oct 2004 Posts: 24
|
Posted: Thu Dec 16, 2004 3:48 pm Post subject: |
|
|
Thanks, this is what I feared. I have not found any examples on how to do this with mysql. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Dec 16, 2004 4:01 pm Post subject: |
|
|
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 |
|
wjdennen Smarty Rookie
Joined: 23 Oct 2004 Posts: 24
|
Posted: Thu Dec 16, 2004 5:39 pm Post subject: |
|
|
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. Thanks again. |
|
Back to top |
|
wjdennen Smarty Rookie
Joined: 23 Oct 2004 Posts: 24
|
Posted: Thu Dec 16, 2004 6:28 pm Post subject: |
|
|
all set now! thanks!
works wonderfully. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Dec 16, 2004 7:11 pm Post subject: |
|
|
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 |
|
|