On 1/31/07, Joefish <[EMAIL PROTECTED]> wrote:
On 1/31/07, Alex Leung <[EMAIL PROTECTED]> 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.
Or get_categories('type=link'). That way you are insulated from DB
schema changes. Using API instead of SELECTs when possible makes
forward compatibility much easier to maintain.
Ryan
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers