• Hi there,
    My blog has been working fine for months without any real problems, but today I noticed that an SQL query that retrieves the posts is returning an error all of a sudden, which is in turn causing the main foreach loop that takes the posts as an argument, to return an error also.
    With my limited knowledge of SQL I can’t see quite what the matter is with the query, but here’s the output:
    <div id='error'>
    SQL/DB Error:
    [<span style='color: #007;'>Got error -1 from table handler</span>]
    SELECT DISTINCT * FROM wpmain_posts WHERE 1=1 AND post_date > '2004-05-11 00:00:00' AND post_date <= '2004-05-23 13:15:44' AND (post_status = "publish") GROUP BY wpmain_posts.ID ORDER BY post_date DESC
    </div>
    And here’s the other error from the foreach loop:
    <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/nocturn/public_html/blogb.php</b> on line <b>2</b>

    If anybody can clue me in on what’s causing that SQL query to fail all of a sudden, then that would be very useful. Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Have you already tried to run a REPAIR TABLE query on the posts table?
    REPAIR TABLE wpmain_posts;

    Thread Starter Jez

    (@jez)

    Thanks for the reply. I’ll bear that advice in mind if something similar happens in the future, however this particular problem appears to have solved itself, so I expect there was just something wrong with my host earlier today or something… Slightly odd, but at least it works again now 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SQL error’ is closed to new replies.