• Hi i hope someone can help me out with this error in my sidebar, when i upgraded from 1.0.9 to 1.2.1 i found this error where my links (blogroll) should be.

    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 gues the problem is whitin my sidebar.php code. so mabe some one can spot an error in here…

    <div class=”right_content”>
    <?php $link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);
    foreach ($link_cats as $link_cat) { ?>

    <div class=”right_header”><?php echo $link_cat->cat_name; ?></div>
    <div class=”right_content”>
    <ul style=”margin-left:20″>
    <?php get_links($link_cat->cat_id, ‘<li class=”li3″>’, ”, ‘ ‘, FALSE, ‘id’, TRUE, TRUE, -1, TRUE); ?>
    </div>

    i tried about everything myselfe, but i gues i′m not that good with php and this kind of errors, hope someone can help me out with this problem…
    regards rizl

Viewing 6 replies - 1 through 6 (of 6 total)
  • Please review the codex as some of the template tags have been changed

    Template_Tags

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The error is that your code is no longer valid with WordPress 2.1 and up. Change it to use the new wp_list_bookmarks function instead.

    Thread Starter rizl

    (@rizl)

    Thank you verry much Otto42 that worked out just fine.
    seems i′m heaving some other trouwbles instead ??
    the layout is all messed up when clicking on the comments or the <MORE> tag ??
    and the (blogroll) links are not showing up when viewing a post aswell…

    anyhow the main page itselfe is working as i should! thanx again

    I had the same problem and found with my version of wordpress the command linkcategories was not working. The code worked fine when I looked into mySQL database and decided to try dropping the link from it altogether like this:

    <?php
    $link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->categories”);
    foreach ($link_cats as $link_cat) {
    ?>

    My blogroll and everything showed up as well. Hopes this helps others with this problem ??

    Remember, wp_categories contains categories for links AND posts.

    Otto42’s suggestion to use wp_list_bookmarks is the recommended approach to this problem.

    It solved It for me:
    $link_cats = $wpdb->get_results(“SELECT wp_terms.term_id, name FROM wp_terms LEFT JOIN wp_term_taxonomy ON wp_term_taxonomy.term_id = wp_terms.term_id WHERE wp_term_taxonomy.taxonomy = ‘category'”);

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sidebar error >> SELECT cat_id, cat_name FROM’ is closed to new replies.