When I use the json_encode() function, the method return a Json with two time the same value: one with the string key and one with an index. I did not have this problem before.
$req = $bdd->prepare("SELECT mail,description FROM identifiant WHERE mail = :mail AND pass=:pass");
if ($req->execute(array(
'mail' => $_COOKIE['mail'],
'pass' => $_COOKIE['pass']))) {
header('Content-type: application/json');
return json_encode($req->fetchAll());
The response:
[
{
"mail": "[email protected]",
"0": "[email protected]",
"description": "a description",
"1": "a description"
}
]
How can I do for don't have index keys ?