I am trying to create a key and value array from database record, but the array just getting the final record! Here is a snippet of my code:
$cateogiresArr = array();
while ($row = mysqli_fetch_row($result))
{
$cateogiresArr["categoryname"] = $row[1];
$cateogiresArr["description"] = $row[2];
}
header("Content-type:application/json");
$json_categories = json_encode($cateogiresArr);