devdept Posted April 8, 2008 Share Posted April 8, 2008 Hi All, I am getting crazy behind these two damn strings : TEZ YAPI İNŞAAT TAAH. MÜH. BİLG. TİC. VE +44 (0588) 555 6666 The first is a real turkish company name, the second a trivial phone number. I can't, again I can't, find a reliable way to store them in a mySQL database and restore them correctly because of the international chars and the plus sign. I would love to see a very easy (working) example using PHP / Sessions / mySQL composed by form.php, process.php and display.php files (using a test mySQL table). Very grateful to you all, Alberto Link to comment https://forums.phpfreaks.com/topic/100118-please-help-me-with-these-two-strings/ Share on other sites More sharing options...
friedemann_bach Posted April 8, 2008 Share Posted April 8, 2008 I also had many problems with foreign or scientific characters. I propose that all collations of your MySQL database should be strictly set to UTF-8 unicode (use either phpMyAdmin or mysql COLLATE). You should also set your MySQL charset to utf8 either by mysql_query("SET NAMES utf8",$your_database_link); or mysql_set_charset('utf8',$your_database_link); Hope this helps! Link to comment https://forums.phpfreaks.com/topic/100118-please-help-me-with-these-two-strings/#findComment-511916 Share on other sites More sharing options...
cooldude832 Posted April 8, 2008 Share Posted April 8, 2008 if the phone numbers will always be the same version then store them as varchars without any of the formatting (integers fail if you have leading zeros fyi) then use substring to reformat it so i.e store as 4405885556666 and to output <?php $phone = "4405885556666"; $phone_formatted = "+".substr($phone,0,2)." (".substr($phone,2,4).") ".substr($phone,6,3)." ",substr($phone,10,4); ?> Link to comment https://forums.phpfreaks.com/topic/100118-please-help-me-with-these-two-strings/#findComment-511929 Share on other sites More sharing options...
devdept Posted April 8, 2008 Author Share Posted April 8, 2008 Hi Guys, thanks for your help. BTW there is an additional complication. Pass these string between one page and the other. The plus sign and the international char make it really diffucult. Is there somewhere in the internet a robust sample using PHP sessions? Thanks, Alberto Link to comment https://forums.phpfreaks.com/topic/100118-please-help-me-with-these-two-strings/#findComment-511952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.