HomePHP Page 6 - Ordering Columns in DDBB Search Results
The Final Words - PHP
In this article we've explored a nice example of how to sort the results of a database search in real time, giving the user a fast response which he or she will surely appreciate. It's not a lot of extra work to do, and I think it's really worth it.
By the way, I like the idea of PHP generating JS that generates HTML!!
Of course, there is a major problem with this trick. If the user browser is too old and doesn't know what innerHTML is, we're in trouble. This trick should only be used if you detect that the user's browser can handle the innerHTML property. If it can't, the "older" approach I explained on the first page of the article could be used, maybe with a message to the user: "Why do you think software companies develop newer versions of their browsers?"
This code was tested succesfully in a P4 1'8 GHz 256 Mb RAM with Windows 2000 Professional, Apache/1.3.27, MySQL 4.0.12, PHP 4.3.1 with the following browsers: Mozilla 1.4 and IE 6.0. It may not be 100% bug free, so I'd appreciate any feedback!