I am returning a JSON array from PHP and this is always empty. Is there something obvious I am missing?
<?php
require("config.inc.php");
$return_arr = array();
$fetch = mysql_query("SELECT startingBool, endingBool FROM vote_count");
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array['startingBool'] = $row['startingBool'];
$row_array['endingBool'] = $row['endingBool'];
array_push($return_arr,$row_array);
}
echo json_encode($return_arr);
?>
while (...) { $return_arr[] = $row; }?$row_arrayrather than using$rowdirectly. This just wastes memory. Have you verified that you enter into your while loop (i.e. have you done any basic debugging)?