I am reading data from a Mysql database like this:
$result = mysqli_query($con,"SELECT * FROM myTable");
while($row = mysqli_fetch_array($result))
{
echo $row['field1'] . " " . $row['field2'];
}
Instead of outputting the records like this:
echo $row['field1'] . " " . $row['field2'];
I need to get them into the format below:
$list = array(
array('field1'=>'something here', 'field2'=>'something else')
);
How do I do this?
$result[] = array('field1'=>$row['field1'], 'field2'=>$row['field2'])?