Hello i have to store data in different pages having next button on them suppose i have an image gallery and i have to display 10 images in a page according to different sorting like sorted in acs or dec order or sort by name etc. I just wanna consider each image as a single item and i wanna 10 items per page. for that i am able to make next button in sorting them by their id,but i am unable to make next button in sorting according to their names... can anybody help me???? please help if you can...!!!!
Help me in php-mysql "Next Button"
Started on the old forum in August 2011 · view the original in the archive · old links redirect here
in you sql use
SELECT what.u.select FROM ur.table ORDER BY ur.name.column LIMIT ur.limit
should order them by name
$("#mfreak").find(".head brain").clone();
Progress:
[|||___________________________] : 5%
Output:
Memory limit reached, unable to complete operation.
Support answer:
Try using a super uber strong mega computer to reach at least 10%.
👋
mFreak wrote: in you sql use
SELECT what.u.select FROM ur.table ORDER BY ur.name.column LIMIT ur.limitshould order them by name
yup that's what i am using select * from tableName order by name limit $limit but how to list second page's entries??? i am not asking about how to list according to name but i wanna knoe how to arrange them with next button working fine
arnage wrote: Use $_GET on button and switch() to query.
yea i used but what will be query??? i passes page=1 , page=2 , page=3 and so on for $_GET problem is that i wanna 10 entries in a page when page=1 it shows entries from 1-10 but how to display 11-20 for page=2 and so on that is exactly what is problem 🙁
I meant another $_GET for sort, for example $sort = $_GET['sort'] and switch ($sort) { $sort ='acs' or dec ... and link page.php?page=2&$sort='.$sort.' ... and query SELECT what.u.select FROM ur.table ORDER BY '.$sort.' LIMIT ur.limit That?
arnage wrote: I meant another $_GET for sort, for example $sort = $_GET['sort'] and switch ($sort) { $sort ='acs' or dec ... and link page.php?page=2&$sort='.$sort.' ... and query SELECT what.u.select FROM ur.table ORDER BY '.$sort.' LIMIT ur.limit That?
what about page.php?page=2???? how will page=2 work???
Added after 11 minutes:
arnage wrote: I meant another $_GET for sort, for example $sort = $_GET['sort'] and switch ($sort) { $sort ='acs' or dec ... and link page.php?page=2&$sort='.$sort.' ... and query SELECT what.u.select FROM ur.table ORDER BY '.$sort.' LIMIT ur.limit That?
hmmm... listen i made a similar page with next button which is working fine there i sort entries according to their "id" which is int type for that i used "select * from tableName where id > $id_of_last_entry_in_previous_page limit $limit" ok? this way if you have to arrange 10 entries per page then for page=2 id will be greater than 10 i.e., id = 11 and limit will stop at 20 for page=2 and so on.. but if i have to arrange them in a sorting order by their name then how can i get last entry of each page and how can i start next page's 1st entry exactly next from previous page's last entry?
Post your code, i realy cant guess.
ohimunda wrote: ... how can i get last entry of each page and how can i start next page's 1st entry exactly next from previous page's last entry?
Thats doing math and loop.