encoding problem
-
Hi guys.
There are problems with the encoding.
Trying to create a plug-in to the admin panel to it. The problem is that when you add data through a plug-in MySql appear “???????????”.Encoding Server have
AddDefaultCharset utf-8Edncoding DB server
UTF-8 Unicode (utf8)encoding table:
InnoDB latin1_swedish_ciencoding other tables:
InnoDB utf8_general_ci InnoDB utf8mb4_unicode_ciTo specify the encoding when you create a database table?
this creates a table:
function create_table() { global $wpdb; $table_name = $wpdb->prefix . "services"; if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, time bigint(11) DEFAULT '0' NOT NULL, name tinytext NOT NULL, text text NOT NULL, url VARCHAR(55) NOT NULL, UNIQUE KEY id (id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } }this insert to table:
function insert_services() { if (isset($_POST['add_service'])) { global $wpdb; var_dump($_POST); $table_name = $wpdb->prefix . "services"; $services_name = $_POST['service_name']; $services_text = $_POST['service_text']; $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $services_name, 'text' => $services_text)); } }sorry for my English
The topic ‘encoding problem’ is closed to new replies.