[wp-testers] Error in SQL syntax?

Joefish joefish.testers at feastofcrumbs.com
Wed Jan 31 18:52:49 GMT 2007


On 1/31/07, Alex Leung <sixsteps at gmail.com> wrote:
> I just realized that I'm getting this error on my Links page:
> http://www.sixsteps.org/links/
>
> *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 cat_id, cat_name FROM
>
> *** Can anybody shed some light on this?

(snip)

I ran into something very similar with a friend. Try changing this:

$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM
$wpdb->linkcategories");

into this:

$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM
$wpdb->categories WHERE link_count > '0'");


That modified SELECT worked just fine for my friend, but then we also
needed to tweak the rest of his custom function.


Regards,
Joefish


More information about the wp-testers mailing list