Weird character when insert to MYSQL DB

Hi all ,


I have code below :
When the $title is 'AIM's' , echo $title in php is ok , however when
insert or update the data ,
it show this : AIMA=C3=A2=E2=82=AC=E2=84=A2s .

Anyone have any ideas why when insert 'AIM's' to MYSQL database ,it
display AIMA=C3=A2=E2=82=AC=E2=84=A2s.
Thanks


if(!$num_rows){
$db_string =3D $DB->compile_db_insert_string( array(
'page_id'
=3D> $page_id,
'title' =3D>$title,
'sub_page'
=3D> $sub_page,
'file_name' =3D> $file_name,
) );

$db_query =3D "INSERT INTO tbl_title (" .$db_string['FIELD_NAMES'].
") VALUES (". $db_string['FIELD_VALUES'] .")";

$DB->query( $db_query );
}else{
// edit
$db_string =3D $DB->compile_db_update_string( array(
'title' =3D> $title,
'sub_page'
=3D> $sub_page,
) );

$db_query =3D "UPDATE tbl_title set " .$db_string. " WHERE file_name
=3D '". $file_name ."'";

$DB->query( $db_query );

}
weetat.yeo [ Mo, 12 März 2007 08:41 ] [ ID #1655133 ]

Re: Weird character when insert to MYSQL DB

weetat <weetat.yeo [at] gmail.com> wrote:
> I have code below :
> When the $title is 'AIM's' , echo $title in php is ok , however when
> insert or update the data ,
> it show this : AIMA’s .

Seems, you're using utf8. When using that, setting it everywhere (the
database _and_ php _and_ the resulting HTML) is easiest on the code.

--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Rik [ Mo, 12 März 2007 09:35 ] [ ID #1655135 ]

Re: Weird character when insert to MYSQL DB

weetat wrote:
> Hi all ,
>
>
> I have code below :
> When the $title is 'AIM's' , echo $title in php is ok , however when
> insert or update the data ,
> it show this : AIMA’s .
>
> Anyone have any ideas why when insert 'AIM's' to MYSQL database ,it
> display AIMA’s.

Try

CREATE TABLE aTable(
aColumn VARCHAR(255)
)
CHARACTER SET utf8;



--

//Aho
Shion [ Mo, 12 März 2007 10:11 ] [ ID #1655136 ]
PHP » alt.php » Weird character when insert to MYSQL DB

Vorheriges Thema: what does backported mean
Nächstes Thema: Help for complete newbie