Title: database error
Last modified: August 18, 2016

---

# database error

 *  [TheFlyerFly](https://wordpress.org/support/users/theflyerfly/)
 * (@theflyerfly)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/database-error-4-2/)
 * hello…im new to WordPress, but have done rather well in customizing it to my 
   liking. the only problem im having is the im getting an error message in my sidebar
   that im not familiar with.
 * here is the 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
 * …and the page it is found on…
 * [http://flyerflies.com/blogs/The_FlyerFly/](http://flyerflies.com/blogs/The_FlyerFly/)
 * …here is the code from my sidebar.php file…
 * [code]
    <div class="sidebar"> <h2><?php _e('Categories'); ?></h2> <ul class="
   menu"> <?php wp_list_cats('sort_column=name'); ?>
 *  <?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Pages') . '
   </h2>' ); ?>
    <?php /* If this is a category archive */ if (is_single()) { ?>
   <h2><?php _e('Archives'); ?></h2>
    -  <?php wp_get_archives('type=monthly&show_post_count=0'); ?>
 *  <?php } ?>
 *  <h2><?php _e('Search'); ?></h2>
 *  <form id="searchform" method="get" action="<?php echo $PHP_SELF; ?>">
    <input
   type="text" name="s" id="s" size="15" /> <input type="submit" name="submit" value
   ="<?php _e('Search'); ?>" /> </form>
 *  <?php if (is_home()) { ?>
    <?php $link_cats = $wpdb->get_results("**SELECT cat_id,
   cat_name FROM** $wpdb->linkcategories"); foreach ($link_cats as $link_cat) { ?
   > <h2><?php echo $link_cat->cat_name; ?></h2>
    -  <?php wp_get_links($link_cat->cat_id); ?>
 *  <?php } ?>
    <?php } ?>
 *  <h2><?php _e('Latest'); ?></h2>
    -  <?php wp_get_archives('type=postbypost&limit=6'); ?>
 *  <?php if (is_home()) { ?>
    <?php if (function_exists('wp_theme_switcher')) {?
   > <h2>Styleswitcher</h2> <?php wp_theme_switcher(); ?> <?php } ?>
 *  <h2><?php _e('Meta:'); ?></h2>
    <ul class="noli"> <?php wp_register(); ?>
    - <?php wp_loginout(); ?>
    - 
    - 
    - ["><?php _e('Valid XHTML'); ?>](http://validator.w3.org/check/referer)
    - [XFN](http://gmpg.org/xfn/)
    -  <?php wp_meta(); ?>
    -  <?php } ?>
    - </div>
       [/code]
    - …i am using MySQL version 4.1.20-max-log, and phpMyAdmin for databasing. but
      i am by no means a databasing or PHP expert. my layout was based on another
      theme, but i checked and the original theme produced the same error. my problem
      is that i dont know nearly enough about PHP syntax to recognize the conflict
      here.
    - can someone point out the issue in my code??
    - thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [TheFlyerFly](https://wordpress.org/support/users/theflyerfly/)
 * (@theflyerfly)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/database-error-4-2/#post-610147)
 * sorry about the code not being nested properly…i wanted to edit it, but i couldnt.
 * if you need me to post the code again, let me know.
 *  Thread Starter [TheFlyerFly](https://wordpress.org/support/users/theflyerfly/)
 * (@theflyerfly)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/database-error-4-2/#post-610163)
 * something i have noticed after staring at my code blankly for quite awhile…
 * the portion of the code that appears to be generating the error has to do with
   search bar results. once i enter something into the search field and submit it,
   the resulting page does not have the error on it.
 * eagerly, yet patiently awaiting some friendly help. thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [TheFlyerFly](https://wordpress.org/support/users/theflyerfly/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/database-error-4-2/#post-610163)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
