• I am at my whit’s end on this one, guys. I purchased a theme through monster and there is an error in the sidebar code that I just cannot wrangle out:

    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]

    I am not a coder so I do what I have always done…replace obvious code snippets with their counterpart from the default theme but more often than not, this makes the sidebar appear completely blank.

    If anybody sees anything really obvious in the sidebar code below, could you please clue me in?

    <div class="right" >
      <div style="padding-left:18px; padding-right:15px"><br/>
        <div class="right_header">Categories:</div>
        <br/>
        <ul class="cats" style="padding-left:20px ">
          <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
        </ul>
      </div>
      <br/>
      <div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/r_sep.gif" alt=""/></div>
      <div style="padding-left:18px; padding-right:15px"><br/>
        <div class="right_header">Archives:</div>
        <br/>
        <ul>
          <?php get_archives('monthly','10','custom','<li class="li">','</li>'); ?>
        </ul>
      </div>
      <br/>
      <div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/r_sep.gif" alt=""/></div>
      {ERROR APPEARS HERE}
    <?php
     $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
     foreach ($link_cats as $link_cat) {
     ?>
      <div style="padding-left:18px; padding-right:15px"><br/>
        <div class="right_header"><?php echo $link_cat->cat_name; ?></div>
        <ul>
          <?php get_links($link_cat->cat_id, '<li class="li">', '</li>', '', FALSE, 'id', TRUE,
    TRUE, -1, TRUE); ?>
        </ul>
      </div>
      <br/>
      <div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/r_sep.gif" alt=""/></div>
      <?php } ?>
      <div style="padding-left:18px; padding-right:15px"><br/>
        <div class="right_header">Staff Links:</div>
        <br/>
        <ul>
          <?php wp_register('<li  class="li">', '</li>'); ?>
          <li  class="li">
            <?php wp_loginout(); ?></li>
          <?php wp_meta(); ?>
        </ul>
      </div>
      <br/>
      <div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/r_sep.gif" alt=""/></div>
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Couple of things – wp_list_cats has been deprecated in the 2.1.x series.
    Replace with wp_list_categories.

    get_archives has been deprecated.
    Replace with wp_get_archives.

    Thread Starter boutwell

    (@boutwell)

    Thanks for the quick reply! I am sure that took care of a problem I have not seen yet lol. It did not remove the one the has been teasing me all morning. I am pretty sure it comes down to this line:

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

    Were there any other deprecations that might be affecting it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sidebar database error’ is closed to new replies.