Wordpress Help

Discussion in 'Web Design and Development' started by lmcintyre, Mar 29, 2007.

  1. lmcintyre macrumors regular

    Joined:
    Jun 22, 2006
    #1
    On my wordpress blog, in the sidebar this shows up......

    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 anyone tell me how to fix this?

    Thanks allot!
     
  2. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #2
    That doesn't seem to be the whole message. Might you provide a link so I can take a look at it? And maybe the code from that part of your sidebar.php file.
     
  3. lmcintyre thread starter macrumors regular

    Joined:
    Jun 22, 2006
    #3
    the site is at agadgetaday.com heres the sidebar.php


    <?php global $freshy_options; ?>

    <div id="sidebar">
    <div>
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <?php if(function_exists('yy_menu')) : ?>
    <h2><?php _e('Navigation',TEMPLATE_DOMAIN); ?></h2>
    <ul>
    <?php yy_menu('sort_column=menu_order&title_li=',
    'hide_empty=0&sort_column=name&optioncount=1&title_li=&hierarchical=1&feed=RSS&feed_image='.get_bloginfo('stylesheet_directory').'/images/icons/feed-icon-10x10.gif'); ?>
    </ul>

    <?php elseif (function_exists('freshy_menu')) :
    freshy_menu($freshy_options['args_pages'],$freshy_options['args_cats']);
    endif; ?>

    <h2><?php _e('Search',TEMPLATE_DOMAIN); ?></h2>
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>

    <h2><?php _e('Links',TEMPLATE_DOMAIN); ?></h2>
    <ul>
    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    ?>
    <li id="linkcat-<?php echo $link_cat->cat_id; ?>"><?php echo $link_cat->cat_name; ?>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </li>
    <?php } ?>
    </ul>
    <?php endif; ?>
    </div>
    </div>
     
  4. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #4
    I'm guessing you're using Wordpress 2.1, but the theme you've got isn't 2.1 compatible. Wordpress changed a number of things behind the scenes, one of them being the way links are handled. The problem is in this bit of code:

    Code:
    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    ?>
    <li id="linkcat-<?php echo $link_cat->cat_id; ?>"><?php echo $link_cat->cat_name; ?>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </li>
    <?php } ?>
    That query (on the first line) is invalid in Wordpress 2.1, I believe. All that logic is unnecessary, in fact; you should be able to replace everything I just quoted with this:

    Code:
    <?php get_links_list(); ?>
    That's it. See if that works.
     
  5. lmcintyre thread starter macrumors regular

    Joined:
    Jun 22, 2006

Share This Page