this is my php code,
$count=mysql_num_rows($query);
if ($count > 0) {
// output data of each row
$foodList[] = array();
while($row =mysqli_fetch_assoc($result))
{
$foodList[] = $row;
}
} else {}
echo json_encode($foodList);
this is my js code:
var $promise = $http.post('foodList.php');
$promise.then(function(msg){
var foodList = msg.data;
if (foodList)
{
//$scope.foodList = foodList;
alert(foodList);
}
else
{
//$scope.msg = "Error user name or password";
}
this is output:
$promise.then(function(msg){*msg = Object {data: Array[1], status: 200, config: Object, statusText: "OK"}*
var foodList = msg.data;*foodList = [Array[0]]*
So: actually 3 data in my data base, but in output just only Array[1]? How to fix it ? THX