I'm working on a symfony2 project. when i insert data with french accents like (é), it is inserted as shown in this image:
when i try to retrieve this data using a php file to use it in android app, i use this code:
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','');
define('DB','adproject');
$con = mysqli_connect(HOST,USER,PASS,DB) or die('unable to connect to db');
$sql = "select * from actualite";
$result = array();
$res = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($res)){
array_push($result,
array('id'=>$row[0],
'login'=>$row[1],
'password'=>$row[2]
));
}
echo json_encode($result);
mysqli_close($con);
?>
I get nothing because of the accents in the database. Any suggestion?
mysqli_function calls! Just to let you know, it's not a good idea.