I know it's strange but I have a select that returns null if the field named name is used. If I remove it then it works, and I already changed the data in the table. If I make a direct query to mysql it works. There might be something in the contents but I can't see anything strange.
Any suggestion that could help me investigate is welcome :(
class go {
function Query($sql){
$results = $this->db->query($sql);
if (mysqli_num_rows($results)<1){
throw new Exception('No Results');
}
$out = array();
while ($r = $results->fetch_object()){
$out[] = $r;
}
return json_encode($out);
$out = null;
}
}
$client = new go;
//not working
$sql = "select name from books limit 10";
$sql = "select name,description from books limit 10";
$sql = "select * from books limit 10";
// works!
$sql = "select description from books limit 10";
$data = $client->Query( $sql );
UPDATE
I found that the problem comes out due to some latin accented characters like ó ñ é