I’m using a jQuery script for a table which paginates and searches through data. It works and functions as it is supposed to.
I’m populating the table with data which consists of over 1,000 records and I’m currently using a PHP while statement to populate it.
Within the table code I have this statement, first I execute the query to get the data, $article = mysql_query("SELECT * FROM articles ORDER BY published DESC");
Then I use the while statement to populate –
while($articles = mysql_fetch_array($article)) {
Whilst this does work, the page load time is so poor and takes a long time to load. Obviously this isn’t the most effective way of populating. Is there an ‘easier’ and efficent way of doing this?
You can change your data types to be smaller so you are downloading less though.
You probably have a lot of excess data you are downloading by selecting * instead of the specific tables you need as well.
You can also use LIMIT x to limit the number of articles/results you get (you probably don’t actually need 1000 on a page right?..)
Other than that, there isn’t much you can do to speed it up because it is taking so long to load due to the time it takes to download from the database, not the efficiency of the PHP script.