How can I make this faster?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
akkassia
Forum Newbie
Posts: 4
Joined: Sun Oct 13, 2002 10:52 am
Location: China

How can I make this faster?

Post by akkassia »

I kind of made a simple version of forum.

And, to divide the lists into many pages I used

Code: Select all

<?php

$page_no = 15; // 15 per page

$query_data = mysql_query("select * from j_$j order by no desc limit $f_article,$page_no", $connect);

while($data = mysql_fetch_array($query)) {
.
.
.
}

?>
And, I've done a test with 100000 articles.

And, when I go to my last page, it gets so slow.

I think it's because at the last page, $f_article value is so big that it takes quite a long time for the mysql to do its job.

I would like to know how you can overcome this.

I think the problem is with the algorism.

Is there a different way to do this?

How do you take care of these problems?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

do you have an index on no in your db? is it the primary index?
Post Reply