WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] SQL database error (8 posts)

  1. jakelowen
    Member
    Posted 7 years ago #

    Help!

    I have the following showing up at the bottom of my site.

    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 '' at line 1]
    SELECT COUNT(DISTINCT ID) FROM

    The site is http://www.jakelowen.com

    Any idea how to get rid of that?

  2. jakelowen
    Member
    Posted 7 years ago #

    Still unresolved.. Anyone have an idea where to start tinkering to fix this problem?

  3. jakelowen
    Member
    Posted 7 years ago #

    As i investigate more I see that the error occurs on all pages (main page, monthly archives, and other added wordpress pages) but does not occur on a particular posts permalink -

    Does that help narrow it down for anybody?

  4. Chris_K
    Member
    Posted 7 years ago #

    Still stumps me, but does cause a question to bubble up: What plugins are you running? And have you experimented with disabling some of 'em?

  5. jakelowen
    Member
    Posted 7 years ago #

    Thanks handy -

    I tried disabling all of them - to no avail.

    i was running podpress, skippy.net's backup and cron plugins.

  6. Chris_K
    Member
    Posted 7 years ago #

    Well, now I reckon we'll want to look at your theme's footer.php. Would you be willing to put the contents of it in a pastebin somewhere and put a link to it here?

  7. jakelowen
    Member
    Posted 7 years ago #

    Got it! I found the solution below:

    The problem and the way akamanu.com PHP Certified Web Developer fixed:

    Inside the file wp-includes/template-functions-links.php there is the following instruction around line 500:

    $numposts = $wpdb->get_var(”SELECT COUNT(DISTINCT ID) FROM $fromwhere”); However the variable $fromwhere is not always initialized when the instruction is executed.

    So we have changed the instruction to:

    if(isset($fromwhere)){ $numposts = $wpdb->get_var(”SELECT COUNT(DISTINCT ID) FROM $fromwhere”);}else{
    $numposts = 0;}

    Now, I only have one more question - How do i get next/previous links on my archive pages?

  8. jakelowen
    Member
    Posted 7 years ago #

    I am closing this post and making a new one that is more specific to my new problem.

    Thanks everyone!

Topic Closed

This topic has been closed to new replies.

About this Topic