FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


MySQL Speed/Security Question





Magicman
I'm building a page that basically lists everything in a database table sorted by any of the table headings in ascending or descending order (similar to the way most email systems allow you to sort by sender, date received, etc.). Currently I have it set up to query the database each time the sort criteria or direction changes and returns the result as an xml file which is processed with an AJAX script. I was thinking of changing it to a system where a separate script queries the database when it changes and writes and xml file which the browsing script will load and sorts with javascript. Would the the second script be worth doing in terms of speed and security or should I just stick with my original setup?
rvec
if you have a big server, all your users have fast internet and there aren't enough users to slow down the server I think your current set-up would be best. In all other circumstances you should do the query only once and do the sorting on the user's pc so you don't even get a request if the users sorts the data in a different way.
kv
It depends on whether pagination is supported or not.

If Pagination Supported:
Sorting can be "in the page" which means it sorts only data which is in that page, which can be done by javascript (not even using ajax, not even retrieving data from server, but use javascript enabled tables to show data in a different order)
OR
Sorting can be "complete", which means you have to get the data from the server since the sorting criteria may change the record set. In this case, it is always better to fetch the sorted data from the database instead of a local file system xml and sort it -- data base is meant to do the data fetch job efficiently.

If pagination not supported:
sorting can be done by javascript (not even using ajax, not even retrieving data from server, but use javascript enabled tables to show data in a different order)
jmraker
It can be done using jQuery

http://tablesorter.com/docs/
http://tablesorter.com/docs/example-pager.html
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.