• I’m getting this error:
    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

    I’m not sure what it means, and I don’t think there is an error in my SQL.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Ive just registered myself because of this problem.

    It would appear that $wpdb->linkcategories is NULL in 2.1, hence breaking any SQL that relies upon it. This doesn’t seem to be a documented change so I’m not sure what’s causing it. :/

    Thread Starter andyh2

    (@andyh2)

    I also did a fresh install on my computer, and it still gives me the error.

    Near enough the same proble here!

    [Unknown column ‘cat_2’ in ‘order clause’]
    SELECT * FROM wp_categories WHERE cat_ID > 0 AND link_count > 0 ORDER BY cat_2 ASC

    Could only get <?php get_links_list(); ?> to work but its not what I want I want to choose when and where I want each category:

    <?php wp_get_links(2); ?>
    <?php get_links_list(2); ?>

    Ok, it seems they’ve joined the categories tables together, so a simple fix for me was changing
    $wpdb->get_results('SELECT cat_id, cat_name FROM ' . $wpdb->linkcategories);

    to this

    $wpdb->get_results('SELECT cat_id, cat_name FROM ' . $wpdb->categories . ' WHERE link_count > 0')

    Thread Starter andyh2

    (@andyh2)

    In which file?

    whichever file is calling $wpdb->linkcategories, possibly one of your theme files. I was calling it in my theme.

    I had similar problems. I’ll describe the problems here, and then my solutions:

    Problem 1) The Links section in my sidebar didn’t display properly, but instead there was an SQL error message, similar to the ones listed above

    Problem 2) No categories were appearing in the sidebar under the “Categories” heading, even though the category name WAS appearing next to each of my posts

    –Solutions–

    Solution 1) Edited sidebar.php, taking out get_grouped_links_list and replacing it with wp_list_bookmarks. You might not have “get_grouped_links_list” (I believe it might be exclusive to the theme I use), but you probably have “get_links_list”, which is now deprecated and should be replaced by “wp_list_bookmarks” if you’re having issues.

    Solution 2)Edited sidebar.php, taking out category_cloud and replacing it with wp_list_categories. You probably won’t have the “category_cloud” function in your sidebar unless you are using the “durable” theme, but you might have another category function that doesn’t work with wp 2.1, and which you need to replace with “wp_list_categories”.

    Hope this helps someone

    Thanks Cheezykins, that worked.

    Doesn’t make sense for me.
    None of my file’s named linkcategories or even similar.

    How to solve this problem?

    Steve

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Links give me database error on update to 2.1’ is closed to new replies.