[wp-testers] Error in SQL syntax?

Alex Leung sixsteps at gmail.com
Thu Feb 1 05:38:37 GMT 2007


Thanx all for the help in resolving this deprecated function issue:)

On 1/31/07, Ryan Boren <ryan at boren.nu> wrote:
>
> On 1/31/07, Joefish <joefish.testers at feastofcrumbs.com> wrote:
> > 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.
>
>
> 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
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>



-- 
Alex Leung
more than a name, it's a value--a way of life: "worship with poles."
2 Samuel 6:13 - http://www.sixsteps.org


More information about the wp-testers mailing list