Title: dbdelta creat table inconsistent behavior
Last modified: August 31, 2016

---

# dbdelta creat table inconsistent behavior

 *  [sk8ermeb](https://wordpress.org/support/users/sk8ermeb/)
 * (@sk8ermeb)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/dbdelta-creat-table-inconsistent-behavior/)
 * I have been getting really inconsistent behavior with the use of dbdelta recently(
   likely since 4.4.2 upgrade). The following (seemingly a bug) has been driving
   me crazy.
 *     ```
       $table_name = $wpdb->prefix . "rbelegvote";
             $sql = "CREATE TABLE " . $table_name . " (
             id mediumint(9) NOT NULL AUTO_INCREMENT,
             email varchar(120) NOT NULL,
             twitid varchar(120) NOT NULL,
             PRIMARY KEY  (id),
             KEY (email)
             );";
             require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
             dbDelta($sql);
       ```
   
 * works, however putting an underscore in the table name so it becomes:
 *     ```
       $table_name = $wpdb->prefix . "rbe_legvote";
             $sql = "CREATE TABLE " . $table_name . " (
             id mediumint(9) NOT NULL AUTO_INCREMENT,
             email varchar(120) NOT NULL,
             twitid varchar(120) NOT NULL,
             PRIMARY KEY  (id),
             KEY (email)
             );";
             require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
             dbDelta($sql);
       ```
   
 * does not work. I have tried this like 10 times to make sure I wasn’t doing something
   stupid. Can anyone out there tell my why the first one would work and the second
   one wouldn’t? The second one used to work and no longer does, and I think I obeyed
   all the strange spacing requirements for db delta. I am suspecting this has to
   do with the wordpress update but not sure. Thank you in advance

The topic ‘dbdelta creat table inconsistent behavior’ is closed to new replies.

## Tags

 * [dbDelta()](https://wordpress.org/support/topic-tag/dbdelta/)
 * [inconsistent](https://wordpress.org/support/topic-tag/inconsistent/)
 * [not](https://wordpress.org/support/topic-tag/not/)
 * [tables](https://wordpress.org/support/topic-tag/tables/)
 * [working](https://wordpress.org/support/topic-tag/working/)

 * 0 replies
 * 1 participant
 * Last reply from: [sk8ermeb](https://wordpress.org/support/users/sk8ermeb/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/dbdelta-creat-table-inconsistent-behavior/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
