Schema not escaped correctly
-
When database name consists of “-” character query will fail with:
ERROR SQL ON : CREATE TABLE IF NOT EXISTS
wp_4_commentmetaLIKE test-site.wp_2_commentmetaWPDB 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 ‘-site.
wp_2_commentmeta‘ at line 1Fixed code:
// Create new table from source table
MUCD_Data::do_sql_query(‘CREATE TABLE IF NOT EXISTS' . $table_name . 'LIKE' . $schema . '.’ . ‘' . $table . '‘);// Populate database with data from source table
MUCD_Data::do_sql_query(‘INSERT' . $table_name . 'SELECT * FROM' . $schema . '.’ . ‘' . $table . '‘);
The topic ‘Schema not escaped correctly’ is closed to new replies.