Hi All,
I am getting a problem in my php script, I have made a search when I search by name or country name or company name, the first time it shows the records as well as the total no. of pages having that type of record but when i click on the 2nd or 3rd .... page of pagination it left that condition and shows me all the records as I have set for the default page when it loads like all the records with all the pages. But I want those records as I searched for with that page no. like 2, or 3.
If anybody can help me in solving this problem.
With regards,
tiachd
Problem related to search code and pagination on the search
Moderator: General Moderators
Re: Problem related to search code and pagination on the search
could you post your code, using the 'Code' button. Thanks
Re: Problem related to search code and pagination on the search
... using [ php ] your code here [ /php ] (without spaces in tags). Otherwise it looses its syntax highlighting and is less readabledeejay wrote:could you post your code, using the 'Code' button. Thanks
There are 10 types of people in this world, those who understand binary and those who don't
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Problem related to search code and pagination on the search
You have to give the pagination links the ability to know which search query is the current query being performed. In other words:tiachd5 wrote:but when i click on the 2nd or 3rd .... page of pagination it left that condition and shows me all the records as I have set for the default page when it loads like all the records with all the pages. But I want those records as I searched for with that page no. like 2, or 3.
Code: Select all
// Bad
echo '<a href="' . $searchUrl . '?page=' . $pageNumber . '">' . $pageNumber . '</a>';Code: Select all
// Good
echo '<a href="' . $searchUrl . '?page=' . $pageNumber . '&query=' . $searchQuery . '">' . $pageNumber . '</a>';Re: Problem related to search code and pagination on the search
I have tried this:
echo '<a href="' . $searchUrl . '?page=' . $pageNumber . '&query=' . $searchQuery . '">' . $pageNumber . '</a>';
not not got the desired result the problem persist still as it was earlier
echo '<a href="' . $searchUrl . '?page=' . $pageNumber . '&query=' . $searchQuery . '">' . $pageNumber . '</a>';
not not got the desired result the problem persist still as it was earlier
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Problem related to search code and pagination on the search
Do not simply "try it." Implement it. It's not a magic solution, it's a concept.
Re: Problem related to search code and pagination on the search
'superdesign' was giving you some food for thought rather than an answer. Afterall we do not know the code you are using to achive pagination. There's always more than 1 way to skin a cat.
is the page number showing in the url after clicking on the page number link.
Vladsun: Sorry, I stand corrected
is the page number showing in the url after clicking on the page number link.
Vladsun: Sorry, I stand corrected