Forum Moderators: coopster

Message Too Old, No Replies

Php, Greek and Mysql Problem

         

Sunrider

1:00 pm on Jan 18, 2004 (gmt 0)

10+ Year Member



Hello all

I an trying to build a custom application that uses PHP and Mysql to store data,

Here's how it works: I have a form to get the the nessesary data and send them to a PHP script which insterts them into a Mysql Database.

Altgough the English characters enter the Mysql table as they were supposed to, the Greek characters appear crewed ( instead of the greek word i get some strange characters ).

Any solution to this problem?

I have searched for almost 2 hours on the net but got no answer so if anyone has an idea on what to do please let me know, because not solving this problem will mean termination of my project, which is not an option.

I am running a Windows XP Pro with ISS, PHP and Mysql installed on the same pc and test all my scripts localy.

Also in case it helps, if I echo the greek text that comes from the form, just before it is about to be insterted in the Database, it shows up just fine. Also if i try to enter the same greek text by using the Mysql command line tool with an INSERT command, the greek text appears just fine within the database.

Unfortunatelly this does not happen if I try to insert the same text by using an PHP script.

Script is available by email, for anyone who might wanna see it.

Thanks in advance
Stratos

justageek

1:43 pm on Jan 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can just utf8 encode the text first and decode it when you pull it out. Mysql supports some of the utf8 but I just use php to do the encoding/decoding.

JAG

Sunrider

9:06 pm on Jan 18, 2004 (gmt 0)

10+ Year Member



I would greatly appriciate if you could give me the syntax of the appropriate command and a line or two of code as examples.

Thank you for taking the time to answer

regards

Stratos

ergophobe

9:15 pm on Jan 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not exactly what you're looking for, but you may find interesting the following threads on Unicode and related issues:

Big 5 to Unicode [webmasterworld.com]

UTF-8, ISO-8859-1, PHP and XHTML [webmasterworld.com]

justageek

11:23 pm on Jan 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use php utf8_encode() and php utf8_decode(). That's really all there is to it. You may want to make sure you output something like <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8"> to the browser also.

JAG

Sunrider

4:05 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



Thanks for all the help guys.

Thank utf8_encode / utf8_decode function saved the day.

Now here's another question that I have: How can I reset the numbering in an Autoincrement Column? Any ideas with example would be great help.

Thanks for the time

Stratos A.