I’m setting up a new web application, and i want to find out a way to insert a row from PHP in Greek language
I make the connection with MySQLi from PHP like this:
$con = mysqli_connect("localhost", "root", "", "Mydb");
if (!$con) {
echo "Error: Unable to connect to MySQL.";
exit; }
if($con){ echo "connected with db <br/>"; }
next step is to enter some values to a table like this:
if(isset($_POST['ok']))
{
mysqli_query($con,"INSERT INTO products (product_name,product_delivery) VALUES ('$product_name','$delivey')");
} }
if i names of values is in English it works perfectly. But if I’m trying to insert a value in Greek language,then the line of the Data Base table corresponding to this record shows me symbols
2
Answers
try the following:
after you connect to the mysql, do this query to make sure that you are using UTF8:
if this does not help, try different encoding, like ISO-8859-1
There is a way to set other language character sets for MySQL as shown here. Hopefully that fixes the problem.