Look at the code
$title = $_post["title"];
$metact _t = $_post["metact_t"];
$acter = $_session["user"];
$department = $_post["department"];
$metinfo = $_post["Metinfo"];
$JB = $_post["JB"];
$department _t = $_post["department_t"];
Get passed over the parameters and make the output test no problem
$title = Iconv ("Utf-8", "GBK", Strip_tags ($title));
$metact _t = Iconv ("Utf-8", "GBK", Strip_tags ($metact _t));
$acter = Iconv ("Utf-8", "GBK", Strip_tags ($acter));
$department = Iconv ("Utf-8", "GBK", Strip_tags ($department));
$metinfo = Iconv ("Utf-8", "GBK", Strip_tags ($metinfo));
$JB = Iconv ("Utf-8", "GBK", Strip_tags ($JB));
$status = Iconv ("Utf-8", "GBK", "unresolved");
$department _t = Iconv ("Utf-8", "GBK", Strip_tags ($department _t));
$SAVEMEETINGSQL = "INSERT into T_metact (id,title,metact_t,acter,department,metinfo,jb,department_t,status)".
"Values (' $id ', ' $title ', ' $metact _t ', ' $acter ', ' $department ', ' $metinfo ', ' $jb ', ' $department _t ', ' $status ')";
Echo ($SAVEMEETINGSQL);
The transcoding output SQL is as follows:
Insert into T_metact (id,title,metact_t,acter,department,metinfo,jb,department_t,status) VALUES (' 2 ', ' Test 0908 ', ' 2014-09-09 ', ' admin ', ' Network Department ', ' Ceshi ', ' significant ', ' network department ', ' unresolved ')
Normal insertion in SQL Manager
Errors in PHP output error: Ncorrect string value: ' \xb2\xe2\xca\xd409 ... ' for column ' title ' at row 1 means that the title corresponds to the test 0908 is not a normal character format, Database design field varchar Length 20, do not know where the problem is, look at the big gods pointing
Reply to discussion (solution)
You send a GBK encoded string to the database, and the default character set of the database is not GBK
So the database does not recognize the incoming string, so an error occurs
What is your database code?
Insert data and data encoding to match.
I'm guessing it's also a problem with encoders.
You send a GBK encoded string to the database, and the default character set of the database is not GBK
So the database does not recognize the incoming string, so an error occurs
I turn the code out of the echo of the SQL is normal Ah, is not clear how to send to the database GBK, it should be a coding problem but I do not know where the problem is, I connect to the database when the encoding set UTF8
What is your database code?
Insert data and data encoding to match.
The database is UTF8, the SQL parameters are inserted I have turned the code, ECHO's SQL execution is no problem
1. There is no database operation function in your code, so I don't know what database you are using. Therefore, no suggestion was made in the reply.
2. You have made a form of the incoming data such as $title = Iconv ("Utf-8", "GBK", Strip_tags ($title)); This way, it turns the Utf-8 code into a GBK code.
3, the error message in the \xb2\xe2\xca\xd409 ... Print it out in PHP
echo "\xb2\xe2\xca\xd409 ...";
is the GBK coded test 09 ...
4, if you connect to the database has declared the use of UTF8, then these GBK encoded data is not belong to the Utf-8 range and error