When I run the following code:
global $wpdb;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$table_tags = $wpdb->prefix . "tags_tb";
$sql = "CREATE TABLE $table_tags (
tag text,
tag_id tinyint,
UNIQUE KEY id (id)
) $charset_collate";
$array = dbDelta( $sql );
print_r(array_values($array));
echo $wpdb->insert(
$table_tags,
array(
'tag_id' => 1,
'tag' => "#AireLibre"
)
);
echo $wpdb->last_error;
I get the following output:
(
[0] => Created table wp_tags_tb
)
Table 'acsm_28e28895e1cdaee.wp_tags_tb' doesn't exist
I think this doesn't make any sense. The table was created right but immediately when performing a query it doesn't exist.
Why can this happen?