WordPress.org

Ready to get started?Download WordPress

Forums

LIMIT -1 coughing up error now for some reason... (8 posts)

  1. Xander
    Member
    Posted 8 years ago #

    The code:

    $posts = get_posts("category=7&orderby=post_title&order=asc&numberposts=-1");

    The error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1]
    SELECT DISTINCT * FROM wp_posts , wp_post2cat WHERE post_date <= '2006-08-17 01:25:05' AND (post_status = 'publish') AND wp_posts.ID = wp_post2cat.post_id AND wp_post2cat.category_id = 7 GROUP BY wp_posts.ID ORDER BY post_title asc LIMIT 0,-1

    The mystery:

    Everything was working 100% fine and then I went on vacation... no changes were made, and suddenly anywhere I had a LIMIT -1 thrown in, wordpress began spitting errors. Any ideas here?

  2. dremation
    Member
    Posted 8 years ago #

    Have you updated WP at all?

  3. yosemite
    Member
    Posted 8 years ago #

    Sure this isn't just a MySQL error? Check with your host...

  4. Xander
    Member
    Posted 8 years ago #

    I wasn't even near a computer when this error began to crop up...

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    numberposts=-1

    Why would you have this set that way anyway? Having a negative number of posts doesn't make much sense to me.

    In other words, I'm not surprised that it doesn't work, I'm surprised that it worked in the first place. :)

  6. Xander
    Member
    Posted 8 years ago #

    I had read somewhere that -1 made for unlimited posts... and it was working for a good six months.

  7. Chris_K
    Member
    Posted 8 years ago #

    Checked with host? Did MySQL get upgraded by them recently by chance...?

  8. Xander
    Member
    Posted 8 years ago #

    Yes, as it turns out. I've had to run around changing limits left and right.

Topic Closed

This topic has been closed to new replies.

About this Topic