Jump to content

Sorting and filtering data without having to keep accessing the database


RedRocky

Recommended Posts

I have a list of records from a database displayed in a table on my web page (using PHP/MySQL).

 

I want to be able to dynamically do the following without having to access the database again:

1) Filter the records (e.g. you enter the surname Smith and only records containing Smith in the surname are displayed), and

2) Sort the records (e.g. by surname, forename etc).

 

I can work out how to do this using Ajax, but even if I am using Ajax, in the background I am still having to access the database again.

 

Is it possible to access the database just once, get all of the records, display the default list of records sorted by a default field, and then allow the user to filter and sort that data without having to reload the data from the database each time?

 

Is it possible to create some sort of dynamic XML file and use that, or is there a better way to do it?

 

Thanks,

Stephen

Here is an example http://tablesorter.com/docs/

Do keep in mind that if you are using pagination of some sort that ajax would prob be a better solution.

 

Hope it works,

 

Rich

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.