Title: Sidebar : WordPress database error
Last modified: August 18, 2016

---

# Sidebar : WordPress database error

 *  [jaaf](https://wordpress.org/support/users/jaaf/)
 * (@jaaf)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/sidebar-wordpress-database-error/)
 * hi,
 * i am getting this error in my side bar
 *     ```
       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
       ```
   
 * and this my sidebar.php file code
 *     ```
       <div class="right">
       <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(__('Right sidebar','theme171')) ) : else : ?>
       <?php
        $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
        foreach ($link_cats as $link_cat) {
        ?>
       							<div class="widget_style2" id="links_with_style">
       								<h2 class="h2"><?php echo $link_cat->cat_name; ?></h2>
       								<ul>
       									<?php get_links($link_cat->cat_id, '<li>', '</li>', '', FALSE, 'rand', TRUE,
       	TRUE, -1, TRUE); ?>
       								</ul>
       							</div>
       <?php } ?>
       							<div class="widget_style2" id="archives">
       								<h2 class="h2"><?php _e('Archives','theme171'); ?></h2>
       								<ul>
       									<?php get_archives('monthly','10','custom','<li>','</li>'); ?>
       								</ul>
       							</div>
   
       							<div class="widget_style2" id="meta">
       								<h2 class="h2"><?php _e('Meta','theme171'); ?></h2>
       								<ul>
       									<?php wp_register('<li>', '</li>'); ?>
       		<li><?php wp_loginout(); ?></li>
       		<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
       		<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
       		<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
       		<?php wp_meta(); ?>
       								</ul>
       							</div>
       <?php endif; ?>
       						</div>
       					</div>
       				</div>
       				<img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" alt="" align="top" style="width:10px; height:14px;"/>
       			</div>
       		</div>
       ```
   

The topic ‘Sidebar : WordPress database error’ is closed to new replies.

## Tags

 * [sidebar.php](https://wordpress.org/support/topic-tag/sidebar-php/)

 * 0 replies
 * 1 participant
 * Last reply from: [jaaf](https://wordpress.org/support/users/jaaf/)
 * Last activity: [18 years, 8 months ago](https://wordpress.org/support/topic/sidebar-wordpress-database-error/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
