webdev, posts by tag: mysql - LiveJournal (original) (raw)

Thank you for you, who tried to help me with my previous post. The solution turned out to be quite surprising (see the update) and still doesn't make sense to me. However, I have a new problem, also with Cyrillic.

I am trying to save the info from the HTML form to MySQL. The info is entered in Cyrillic. It is sent through email and displayed by a browser as expected. However, I get only empty cells in MySQL if I enter Cyrillic (it's all fine with latin).

I use the following simple code

mysql_query("SET CHARACTER SET utf8");

mysql_query("SET NAMES 'utf8'");

$query = "INSERT INTO " .PATIENT_TBL. "

(name, town, email)

VALUES('$name','$town', '$email')";

result=mysqlquery(result = mysql_query(result=mysqlquery(query);

Columns "name" and "town" have Collation utf8_general_ci. For the database default and table default I tried utf8_general_ci and c1251_general_ci - no help. Moreover, the same code works perfectly fine on my local machine, but not on a "real" server. Any ideas? Thank you.

UPDATE: Thank you ivashkevich . The problem was that in my form it was: <meta http-equiv="content-type" content="text/html; charset=windows-1251" instead of "<meta http-equiv="content-type" content="text/html; charset=utf-8"