On Fri, 2010-01-22 at 17:15 +0100, Jochem Maas wrote: > Op 1/22/10 9:41 AM, Ashley Sheridan schreef: > > On Fri, 2010-01-22 at 03:47 +0100, Jochem Maas wrote: > > > >> 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. > >>>> > >>>> > >>> > >> > >> > > > > > > You're also forgetting one of the most important elements of this. If > > you're displaying the characters on a web page, chances are that you > > need to add a corresponding meta tag to inform the browser that the > > content is utf-8 > > > > <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> > > > > Otherwise the browser will attempt to guess from the first few > > characters of output, and because of the large headers in some websites, > > will guess completely wrong. > > that was point 4. in my original post, I'd also say that the META tag is a bit > lame on it's own ... better off actually setting the proper content encoding HTTP header > (and using the META tag as well to cover for dumb ass browsers) > > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > > > > You'd be surprised how many people still use a dumb browser! Thankfully though, it seems that people are wising up a bit more, as these stats from a media website show: Safari 4 2624 Firefox 3.5 1320 Firefox 3 690 IE 8 501 IE 6 465 IE 7 417 Safari 3.2 171 Firefox 2 151 Mozilla 1.9 109 Unknown 0 56 Safari 3.1 53 Chrome 3 34 Safari 3 19 Google Webmaster Tools 0 7 Flock 2 5 Opera 10 1 This is a media-based website, which would explain the large use of browsers available for the Mac, but I still take it as a good sign. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php