Jump to content

[SOLVED] Help needed optimizing a PHP page


chitchatter

Recommended Posts

I am relatively new to PHP, mysql and have a forum with 10,000 topics.

 

On one page I display all the topics created in that forum. My code goes like this

 

if cache file is less than 24 hours old;

include cache file;

else

SELECT topic_id, topic_title FROM topics_table WHERE forum id NOT IN (x,y,z);

fwrite output to cache file;

echo output;

end if;

 

The resultant query gives an output/cache file that is 10,000 rows, 1.3Mb unzipped and 300kb gzipped in size.

 

Is there a better way to do this other than to break up the output into several pages?

 

short answer, no, not if you're wanting to display ALL topics on 1 page.

 

however, I would suggest getting rid of the cache file and paginating instead, that way you wont have a cache file that's hours otu of date, you'll have a constantly up to date connection to your DB.

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.