Recent Topics

1 Aug 25, 2007 20:53    

My b2evolution Version: 0.93

HI!

I am using this code fragment to get some articles out of the database:

    $sql = "SELECT ID , post_title, post_urltitle, post_issue_date
    FROM evo_posts
    INNER JOIN evo_postcats ON ID = postcat_post_ID
    INNER JOIN evo_categories ON postcat_cat_ID = cat_ID
    WHERE cat_blog_ID = '7'
    AND post_status = 'published'
    GROUP BY post_issue_date
    LIMIT $limit";

But if I set the limit to none or remove it, it keeps spitting out the newest article on and on and never stops. How can I make the script to stop when the newest article is selected?

2 Aug 25, 2007 21:35

I can't tell you from this piece what the JOINs do, but does the repeat really come from this code? In other words, does the code give the same result if you directly execute it in phpMyAdmin? In even other words: can the preceding php have anything to do with it?

Further you could try to strip the code from a few lines and see when it starts to repeat the output, but I think you tried that already.

Good luck

3 Aug 27, 2007 02:48

try changing

 limit $limit; 

to

 limit 0,1; 

4 Aug 27, 2007 12:04

Well actually, Afwas was right. It was an error in the php code and not in the SQL-Statement. =)

I should think first before I post. Sorry for disturbing you!


Form is loading...