From: Ryan Park on

Hello I'm currently trying to use PHP to insert foreign characters into one of the mysql database tables.mysql_query() worked seamlessly, but when I check the inserted data on phpMyAdmin it shows the foreign characters in broken letters, like this ì‹œíŒ <- jibberish...The foreign characters show fine when I'm typing it out on my editor to code PHP, but it gets broken into unrecognizable symbols when put into mysql database columns..
I tried to create the same thing this time through phpMyAdmin console and it worked great, the foreign characters showed correctly as they should.The column that I'm trying to put the foreign characters into is set as utf8_general_ci.I wish to use PHP to insert the data into the database because I'll be inserting massive amounts of them at once, so I just can't continue with this problem at hand.
I'll greatly appreciate any help, thank you.
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/196390709/direct/01/
From: Jim Lucas on
Ryan Park wrote:
> Hello I'm currently trying to use PHP to insert foreign characters into one of the mysql database tables.mysql_query() worked seamlessly, but when I check the inserted data on phpMyAdmin it shows the foreign characters in broken letters, like this 시� <- jibberish...The foreign characters show fine when I'm typing it out on my editor to code PHP, but it gets broken into unrecognizable symbols when put into mysql database columns.
> I tried to create the same thing this time through phpMyAdmin console and it worked great, the foreign characters showed correctly as they should.The column that I'm trying to put the foreign characters into is set as utf8_general_ci.I wish to use PHP to insert the data into the database because I'll be inserting massive amounts of them at once, so I just can't continue with this problem at hand.
> I'll greatly appreciate any help, thank you.
> _________________________________________________________________
> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
> http://clk.atdmt.com/GBL/go/196390709/direct/01/

How about showing a little of the insert code. ie: how you are gathering the
data, how you are preping the data, and the actual insert statement.

--
Jim Lucas
NOC Manager
541-323-9113
BendTel, Inc.
http://www.bendtel.com
From: Ryan Park on
Forgot to reply all.

You can see that it's in the middle of the sql statement.
It looks fine here but some how it breaks during the query.

<?php
mysql_connect("localhost", "adminID", "password") or die(mysql_error());
echo "Connected to MySQL<br />";

mysql_select_db("databasename") or die(mysql_error());
echo "Connected to Database<br />";

$sql = "INSERT INTO xe_modules (module_srl, module, module_category_srl,
layout_srl, menu_srl, site_srl, mid, skin, browser_title, description,
is_default, content, open_rss, header_text, footer_text, regdate) VALUES
('135', 'bodex', '0', '53', '0', '0', 'free', 'xe_default', '자유게시판
', '', 'N', '', 'Y', '', '', UNIX_TIMESTAMP());";

mysql_query($sql) or die(mysql_error());

mysql_close();
?>

On 1/21/2010 5:19 PM, Jim Lucas wrote:
> Ryan Park wrote:
>
>> Hello I'm currently trying to use PHP to insert foreign characters into one of the mysql database tables.mysql_query() worked seamlessly, but when I check the inserted data on phpMyAdmin it shows the foreign characters in broken letters, like this ì‹œíŒ<- jibberish...The foreign characters show fine when I'm typing it out on my editor to code PHP, but it gets broken into unrecognizable symbols when put into mysql database columns.
>> I tried to create the same thing this time through phpMyAdmin console and it worked great, the foreign characters showed correctly as they should.The column that I'm trying to put the foreign characters into is set as utf8_general_ci.I wish to use PHP to insert the data into the database because I'll be inserting massive amounts of them at once, so I just can't continue with this problem at hand.
>> I'll greatly appreciate any help, thank you.
>> _________________________________________________________________
>> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
>> http://clk.atdmt.com/GBL/go/196390709/direct/01/
>>
> How about showing a little of the insert code. ie: how you are gathering the
> data, how you are preping the data, and the actual insert statement.
>
>
From: Eric Lee on
Hi, all,

I'am not able test it out now.
Did you tried to change the collation to utf8_bin from utf8_general_ci ?


Eric,
Regards,


On 1/22/10, Ryan Park <ryanhpark(a)live.com> wrote:
>
> Forgot to reply all.
>
> You can see that it's in the middle of the sql statement.
> It looks fine here but some how it breaks during the query.
>
> <?php
> mysql_connect("localhost", "adminID", "password") or die(mysql_error());
> echo "Connected to MySQL<br />";
>
> mysql_select_db("databasename") or die(mysql_error());
> echo "Connected to Database<br />";
>
> $sql = "INSERT INTO xe_modules (module_srl, module, module_category_srl,
> layout_srl, menu_srl, site_srl, mid, skin, browser_title, description,
> is_default, content, open_rss, header_text, footer_text, regdate) VALUES
> ('135', 'bodex', '0', '53', '0', '0', 'free', 'xe_default', '자유게시판 ', '',
> 'N', '', 'Y', '', '', UNIX_TIMESTAMP());";
>
> mysql_query($sql) or die(mysql_error());
>
> mysql_close();
> ?>
>
> On 1/21/2010 5:19 PM, Jim Lucas wrote:
>
>> Ryan Park wrote:
>>
>>
>>> Hello I'm currently trying to use PHP to insert foreign characters into
>>> one of the mysql database tables.mysql_query() worked seamlessly, but when I
>>> check the inserted data on phpMyAdmin it shows the foreign characters in
>>> broken letters, like this ì‹œíŒ<- jibberish....The foreign characters show
>>> fine when I'm typing it out on my editor to code PHP, but it gets broken
>>> into unrecognizable symbols when put into mysql database columns.
>>> I tried to create the same thing this time through phpMyAdmin console and
>>> it worked great, the foreign characters showed correctly as they should..The
>>> column that I'm trying to put the foreign characters into is set as
>>> utf8_general_ci.I wish to use PHP to insert the data into the database
>>> because I'll be inserting massive amounts of them at once, so I just can't
>>> continue with this problem at hand.
>>> I'll greatly appreciate any help, thank you.
>>>
>>> _________________________________________________________________
>>> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
>>> http://clk.atdmt.com/GBL/go/196390709/direct/01/
>>>
>>>
>> How about showing a little of the insert code. ie: how you are gathering
>> the
>> data, how you are preping the data, and the actual insert statement.
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
From: Jochem Maas on
Op 1/22/10 2:28 AM, Ryan Park schreef:
> Forgot to reply all.
>
> You can see that it's in the middle of the sql statement.
> It looks fine here but some how it breaks during the query.
>
> <?php
> mysql_connect("localhost", "adminID", "password") or die(mysql_error());
> echo "Connected to MySQL<br />";
>
> mysql_select_db("databasename") or die(mysql_error());
> echo "Connected to Database<br />";
>
> $sql = "INSERT INTO xe_modules (module_srl, module, module_category_srl,
> layout_srl, menu_srl, site_srl, mid, skin, browser_title, description,
> is_default, content, open_rss, header_text, footer_text, regdate) VALUES
> ('135', 'bodex', '0', '53', '0', '0', 'free', 'xe_default', '자유게시판
> ', '', 'N', '', 'Y', '', '', UNIX_TIMESTAMP());";

you need to:

1. have some understanding of char encoding and character sets.
2. define you DB[tables] to use a collation that supports the stuff you want to enter.
3. you need to connect to the DB with a suitable charset (google 'SET NAMES')
4. you need to make sure the data you are putting into your queries is in that same charset.

basically you need UTF8 - be prepared for some pain and a lot of reading in order
to get to grips with these concepts, I've personally found that encoding, charsets et al
are not the easiest things to one's head round.

>
> mysql_query($sql) or die(mysql_error());
>
> mysql_close();
> ?>
>
> On 1/21/2010 5:19 PM, Jim Lucas wrote:
>> Ryan Park wrote:
>>
>>> Hello I'm currently trying to use PHP to insert foreign characters
>>> into one of the mysql database tables.mysql_query() worked
>>> seamlessly, but when I check the inserted data on phpMyAdmin it shows
>>> the foreign characters in broken letters, like this ì‹œíŒ<-
>>> jibberish...The foreign characters show fine when I'm typing it out
>>> on my editor to code PHP, but it gets broken into unrecognizable
>>> symbols when put into mysql database columns.
>>> I tried to create the same thing this time through phpMyAdmin console
>>> and it worked great, the foreign characters showed correctly as they
>>> should.The column that I'm trying to put the foreign characters into
>>> is set as utf8_general_ci.I wish to use PHP to insert the data into
>>> the database because I'll be inserting massive amounts of them at
>>> once, so I just can't continue with this problem at hand.
>>> I'll greatly appreciate any help, thank you.
>>> _________________________________________________________________
>>> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
>>> http://clk.atdmt.com/GBL/go/196390709/direct/01/
>>>
>> How about showing a little of the insert code. ie: how you are
>> gathering the
>> data, how you are preping the data, and the actual insert statement.
>>
>>
>