6
Hello, I want to pass the result of a select to json, but I can’t check why I can’t see it.
So someone could tell me why this code doesn’t 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]"
}
This is an ajax request response?
– Ricardo Moraleida