![]() Topic awaiting preservation: Sortable Table pulled from Mysql with PHP (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
![]() Ok here is the deal. |
Maniac (V) Inmate From: under the bed |
![]() Why not just go back to the DB? |
Nervous Wreck (II) Inmate From: |
![]() Well first off if I go back to the database I have to requery the database, if I used a dhtml method of it I could just resort client side without the need to hit the database. Obviously I would not want to transfer a huge list over the internet multiple times per user, especially if I have hundreds to thousands of users on the website. |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
![]() Carnage: Hmmmmmmmm its an interesting one - if I wanted to look at the first page and had to wait for 100 pages to download then I doubt I would be very happy. You can do this client-side but you could start getting into trouble. The 2 solutions I'd consider are: |
Maniac (V) Inmate From: under the bed |
![]() quote:
|
Nervous Wreck (II) Inmate From: |
![]() Yeah I currently have it implemented as #2. I just move my start variable for use in LIMIT forwards or backwards when they change pages. And if they want to sort by a diff column ASC or DESC I do it via the SORT in the mysql pull. Was just wondering if there was a way to do this without hitting the database every time. Maybe a cachable version of the SQL query that could be implemented client side but on a cached txt file or the like that would expire in X amount of time, or by doing it client side. |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
![]() Carnage: There may be design restrictions that you haven't outlined but if you use LIMIT (rather than some terrible waste of resources like grabbing them all and then using PHP to pump out the required output) then that is a reasonably flexible and efficient use of MySQL. |
Bipolar (III) Inmate From: Amsterdam |
![]() Yup, |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
![]() Yep and its worth pointing out that MySQL operates faster than PHP so it is always worth getting it to do the processing for you if you can. |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
![]() hm... quick fix: two divs, one sorted asc, one desc, hide the other one when the user clicks. |