I am trying to store some Arabic data in a mysql database I have set the html document charset to be 'utf8'
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
MySQL charset is set to: UTF-8 Unicode (utf8)
MySQL connection collation is set to: utf8_general_ci
Database and table collations are set to: utf8_general_ci
In addition in my php code I used the $mysqli->set_charset("utf8")
function to ensure that the charset is set to be ut8 but nothing is actually working , I am posting my data to the php script using html form where the enctype is : enctype="multipart/form-data"
because in this form I also upload an image
The weird thing is that when I write my query directly in mysql the Arabic characters are stored properly with no problem , but when I use a php query to store the data all the characters are stored in a wrong charset encoding
Any suggestions ?
Browsers will ignore the
<meta http-equiv ...>
tag if there is a http header present. Try putting this at the top of your php page:You may try this. It should work
save this file in ur website, htdocs folder as "dbh.php, then in include it at the top of your index page by typing
<?php include 'dbh.php';?>
and you u are ready to go.Weird, It should work!
Try adding these lines after a successful connection to the database:
For example:
And include these META tags in the head section of your php page: