2
Hello, all right, all right?
I am taking the values of a table in a database and "transform" them into JSON. I am with the following PHP code:
$sql = "SELECT * FROM pessoas";
$query = mysqli_query($mysqli, $sql);
$arr = array();
while ($dados = mysqli_fetch_assoc($query)) {
$arr['nome'] = $dados['nome'];
$arr['sobrenome'] = $dados['sobrenome'];
}
return json_encode($arr);
But he returns to me only
{"nome":"Leo","sobrenome":"Nerone"}
But I would like him to return everything, for example:
{"nome":"Leo","sobrenome":"Nerone"},
{"nome":"Alguem","sobrenome":"Loco"}
How to do this?
+1 This is the best solution and solves the problem.
– Inkeliz