I am trying to return information from a mysql database using php and need to get rid of the "" in the dynamic values. I have tried using real_escape_string and trim but this has not worked.
while($row = mysqli_fetch_assoc($result)) {
$myArray= array(
// array("running"=> 23),
// array("walking"=> 54)
array("running"=>$row['running']),
array("walking"=>$row['walking'])
);
}
echo json_encode($myArray);
As the code currently stands it returns [{"running":"23"},{"walking":"54"}]
However, I need it to return [{"running":23},{"walking":54}]
without the "" characters (It returns this using my commented out static code)