what's wrong in my code? i cant show the data in json...
here's my code..
i'm using oracle with adodb
function getDados(){
try{
$sql = "SELECT * FROM TMP0145705";
$db = getDB();
if($db){
$stmt = $db->Execute($sql);
$ret = array();
/*while ($arr = $stmt->FetchRow()) {
print_r($arr);
echo "<hr>";
}*/
while(!$stmt->EOF){
$ret[] = $stmt->fields;
$stmt->MoveNext();
}
echo '{"ret": ' . json_encode($ret) . '}';
}
$db = null;
}catch(Exception $e){
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
edit:
my json:
{"ret": }
edit:
print_r($ret);
Array ( [0] => Array ( [0] => [MANAGERS] => [1] => 1 [FACTORY] => 1 [2] => 1 [PRODUCT] => 1 [3] => 174))
edit:
$ret = $stmt->GetArray();
var_dump($ret);
echo '{"ret": ' . json_encode($ret) . '}';
if( $jret = json_encode($ret) ){ echo "nice"; } else{ echo "Fail"; }
solution!:
my data is in utf-08 and for some reason the json cannot accept that...
how can i resolve that?