Header ("Content-type:text/html;charset=utf-8");
$title =$_post[' F_title '];
$content =$_post[' f_content '];
Connecting to a database
$link =mysql_connect (' localhost ', ' root ', ');
Select Database
mysql_select_db (' BBS ', $link);
Set character sets
mysql_query ("Set names UTF8");
Generating SQL statements
$sql = "INSERT into Bss_info (title,content,add_time) VALUES (' $title ', ' $content ', Now ())";
Execute SQL statement
$rs =mysql_query ($sql);
Generate SQL Error prompt
Echo Mysql_error ();
Page Information Tips
if ($RS)
{
echo "message added successfully!";
}else
{
echo "message added failed!";
}
?>
Reply to discussion (solution)
1, the table is UTF8 code?
2, file encoding is Utf-8 code?
When you insert data that is UTF-8 encoded
Only need mysql_query ("Set names UTF8")
1, the table is UTF8 code?
2, file encoding is Utf-8 code?
Open my above PHP page through Notepad, file?? Save as display encoding when Utf-8
Mmsql:my.ini file shows: Default-character-set=utf8
I really don't know what's wrong!
My qq:380492399, which master knows the problem, can help me to see remotely, grateful.
In
Execute SQL statement
Before joining
echo Base64_encode ($sql);
Post the results
Your database is not necessarily utf8 ... If you don't, you'll get a problem.
Take a look at it with phpMyAdmin ...
Your database is not necessarily utf8 ... If you don't, you'll get a problem.
Take a look at it with phpMyAdmin ...
Is the character set setting of the database not the "Default-character-set=utf8" in the My.ini file, is there any other place to set it up?
Reference to the 6 floor phpnewnew reply: Your database is not necessarily utf8 ... If you don't, you'll get a problem.
Take a look at it with phpMyAdmin ...
Is the character set setting of the database not the "Default-character-set=utf8" in the My.ini file, is there any other place to set it up?
You see... He called the default ... Which means you can also customize the table ...
Right?
Let's go to phpmyadmin. What kind of code is the database setup?
Thank you for your warm reply, the console character set should be GBK.