Topic awaiting preservation: Sortable Table pulled from Mysql with PHP |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: |
posted 10-06-2003 17:47
Ok here is the deal. |
Maniac (V) Inmate From: under the bed |
posted 10-06-2003 19:08
Why not just go back to the DB? |
Nervous Wreck (II) Inmate From: |
posted 10-06-2003 19:14
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 |
posted 10-06-2003 20:16
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 |
posted 10-06-2003 21:13
quote:
|
Nervous Wreck (II) Inmate From: |
posted 10-06-2003 21:27
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 |
posted 10-06-2003 22:11
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 |
posted 10-07-2003 01:46
Yup, |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 10-07-2003 02:26
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 |
posted 10-07-2003 09:37
hm... quick fix: two divs, one sorted asc, one desc, hide the other one when the user clicks. |