I am trying to fetch results from the database into an array and then encoding that array into a json string but it does not echo any results. Can anybody figure out why?
$result=mysql_query($sql,$conn);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$unique_array[] = array('id'=>$row['id'], 'name'=>$row['name'],'province'=>$row['province']);
}
echo(json_encode($unique_array));
var_dump($unique_array);right before theecho(json_, just in order to make sure that thewhileloop is running and populating that variable.