1
I’m having a hard time with json_encode
echo json_encode($autocomplete -> fetchAll(PDO :: FETCH_ASSOC));
i am doing a database select so far so all right, but when it transfers the data to this echo up there, appear many characters that javascript is not accepting, as I transform the output from above that is displayed as below
[{"user_name":"Roberto Monteiro"},{"user_name":"Dk Teclive"},{"user_name":"Fye Flourigh"}]
in the format below that is accepted by javascript
["Roberto Monteiro", "Dk Teclive", "Fye Flourigh"];
I mean, how can I turn this
[{"user_name":"Roberto Monteiro"},{"user_name":"Dk Teclive"},{"user_name":"Fye Flourigh"}]
and leave in this format
["Roberto Monteiro", "Dk Teclive", "Fye Flourigh"];
whether with php or javascript, if possible, in both ways, thanks from now on.
Dude, you’re a genius, it worked 100%, thank you very much.
– flourigh