Jump to content

Please help me with these two strings


devdept

Recommended Posts

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

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!

 

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);
?>

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.