Hello, I want to pass the result from a select to json, but I can not see why I can not see it.
So could anyone tell me why this code does not print anything?
include_once 'conexao.php';
$query = "SELECT client_id, name, email FROM client";
$result = $dbcon->query($query);
$rows = array();
while($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
echo json_encode($rows);
Result of var_dump($rows)
:
array(8) {
[0]=> array(3) {
["client_id"]=> string(1) "1"
["name"]=> string(26) "Fernanda Neri Duarte Silva"
["email"]=> string(18) "[email protected]"
}
[1]=> array(3) {
["client_id"]=> string(1) "2"
["name"]=> string(36) "Elaine Cristina Gon�alves Durvalino "
["email"]=> string(16) "[email protected]"
}