i am retriving a .php file which json_encodes the results from a recordset.
it produces the json fine but it misses the first record in the recordset,
so if i have 21 rows it only creates a json object with 20 records, with the first one missing.
function recordSetToJson($mysql_result) {
$rs = array();
while($rs[] = mysql_fetch_assoc($mysql_result)) {
// you don´t really need to do anything here.
}
return json_encode($rs);
}
echo '{"myFiles":'.recordSetToJson($UserFiles).'}';
i tried:
function recordSetToJson($mysql_result) {
$rs = array();
do{
// you don´t really need to do anything here.
}
return json_encode($rs);
}while($rs[] = mysql_fetch_assoc($mysql_result))
echo '{"myFiles":'.recordSetToJson($UserFiles).'}';
but this just produces a blank page.