php - Echo JSON encode not echoing anything -
this working absolutely fine until today when stopped working... (i know isn't helpful i've looked around everywhere)
i'm iterating through values returned mysql query , putting each of them array placed inside array. try jsonencode array , echo that, no longer works.
$rows = array(); while(($row = mysqli_fetch_array($result))) { $record = array("id" => $row[0],"image" => $row[1]); $rows[] = $record; } echo json_encode($rows);
this literally returns blank page. vardump of $rows variable shows it's populated of arrays
array (size=50) 0 => array (size=2) 'id' => string '13847519' (length=8) 'image' => string 'path image' (length=13) 1 => array (size=2) 'id' => string '73829485' (length=8) 'image' => string 'path image' (length=13) ...
any appreciated! i'm confused!
json_encode
can return null
in case non utf characrers. please run:
var_dump(json_encode($rows));
and see null
. can try solution in link above.
Comments
Post a Comment