I'm really having trouble trying to execute the function below:
function retrieve_as_JSON($sql_statement)
{
$r = oquery($sqli); // oquery runs all that conn()->query() stuff
if($r->num_rows)
{
$arr = array();
while($tmp = $r->fetch_array( MYSQLI_ASSOC ))
{
$arr[] = json_encode($tmp);
}
return json_encode($arr);
}
}
$tmp
in the loop is:
Array ( [code] => ecb36c8e9e70b1622fb85ce1af7ba824
[prsn] => a6abd41ca4376f1ccb5d8425e9e97ca6
[type] => Isento
[motn] => Nome da Mãe
[natu] => Joseense
[nati] => Brasileiro
[mrts] => Solteiro(a)
[conj] => Nome da esposa
[prof] => Analista/Programador
[skcl] => Caucasiano/Branca
[lafr] => 0 )
The result is "[false]". Without the json_encode()
, it return a regular array() filled with information. Using just one time the json encode function, on return or inside the while, it still gives nothing...
Any help?