0

I want to store arabic in mysql database but when I execute query it convert arabic to some numbers like u0645u0631u062du0628u0627

when I print this query in which $datas='hello'

insert into taxi_notification(user_id,message,datetime,type) 
    values(".$user_id.",'".$datas."',NOW(),'".$type."');

it converts it to

insert into taxi_notification(user_id,message,datetime,type) 
    values(1965,'\u0645\u0631\u062d\u0628\u0627',NOW(),'admin_notification')

I want to store Arabic string as it display in browser

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Please read [utf-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) It may well answer your question – RiggsFolly Aug 06 '19 at 11:00
  • **ALSO** Your script is wide open to [SQL Injection Attack](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) Even [if you are escaping inputs, its not safe!](http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string) Use [prepared parameterized statements](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) in either the `MYSQLI_` or `PDO` API's – RiggsFolly Aug 06 '19 at 11:01

1 Answers1

0

You must have to change your collation as utf8_general_ci.

enter image description here

Shivani Sonagara
  • 1,299
  • 9
  • 21