Mysql help with view more button.

Posted by WAC0020 on Stack Overflow See other posts from Stack Overflow or by WAC0020
Published on 2010-05-18T21:42:30Z Indexed on 2010/05/18 21:50 UTC
Read the original article Hit count: 148

Filed under:
|

I am working on a widget that is a lot like twitters widget where there is a list of postings and a view more button. I can get it to work with using ID variables but I would like to sort by popular posts.

Here is my mysq code:

$sql = "SELECT id, title, category, icon_normal, status, description, views_monthly FROM posts WHERE views_monthly<=".$lastPost." AND status='1' ORDER BY views_monthly DESC LIMIT 9"

So the problem that I am having is it shows the first 9 just fine. When it gets to the point where views_monthly = 0 then it just loads the same 9 post over again.

How do it get it to switch to using ID when it reaches Views_monthly = 0 and load fresh posts?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql