im retrieving some data in my database table and than convert to json, but i need to create a array with this structire in my php loop
["postcode"=>"townName"...]
but instead is giving me
["postcode=>townName"...]
My code:
$sql = "SELECT * FROM uk_postcodes";
$result = mysqli_query($connection, $sql) or die("Error " . mysqli_error($connection));
$dname_list = array();
while($row = mysqli_fetch_array($result))
{
$dname_list[] = $row['postcode']."=>".$row['town'];
}
echo json_encode($dname_list);