[提问]求助~~急~~~~ php向mysql写入数据时出中文写不进去 |
大家好,我是学php的新手,今天自己做网站的时候碰到一个问题,望大虾们帮忙给小弟看看是怎么回事。
<?
//***********数据库中article表的结构如下**********
//art_id int(4) not null auto_increment
//art_title varchar(50) not null
//art_pclass varchar(8) not null
//art_class varchar(8) not null
//art_source varchar(40)
//art_author varchar(10)
//art_validate char(2) not null
//art_on_top char(2) not null
//art_pink char(2) not null
//art_promulgate_date date
//art_content blob not null
//art_keywords varchar(50)
//art_description varchar(50)
//primary key(art_id)
//***********************************************
$art_title=trim($_POST['art_title']);
$art_source=trim($_POST['art_source']);
$art_author=trim($_POST['art_author']);
$art_promulgate_date=date("Y-m-d",time());
$art_content=$_POST['FCKeditor1'];
$art_keywords=trim($_POST['art_keywords']);
$art_description=trim($_POST['art_description']);
$art_pclass=$_POST['art_pclass'];
$art_class=$_POST['art_class'];
$art_validate=$_POST['art_validate'];
$art_on_top=$_POST['art_on_top'];
$art_pink=$_POST['art_pink'];
$querystr_insert_into_article="insert into article set art_title='".$art_title."',art_pclass='".$art_pclass."',art_class='".$art_class."',art_source='".$art_source."',art_author='".$art_author."',art_validate='".$art_validate."',art_on_top='".$art_on_top."',art_pink='".$art_pink."',art_promulgate_date='".$art_promulgate_date."',art_content='".$art_content."',art_keywords='".$art_keywords."',art_description='".$art_description."'";
如果在表单中输入英文,字段向数据库中写入一点问题都没有,可要是输中文就不行了,输中文时数据库中varchar和char字段的全为空,其余字段正常。
将程序生成的$querystr_insert_into_article的值用echo显示出来,再将起复制,直接在mysql的环境中一切又正常,请问各位大虾,这到底是怎么回事啊?麻烦了,谢谢~~~
|
|
|