i am trying to push multiple arrays into 1 big array, resulting in a 2 lvl array.
I got this set of arrays for example:
Array ( [cod] => ffffd [denum] =
Don't use array_values
on your $row
$res_arr_values = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
array_push($res_arr_values, $row);
}
Also, the preferred way to add a value to an array is writing $array[] = $value;
, not using array_push
$res_arr_values = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$res_arr_values[] = $row;
}
And a further optimization is not to call mysql_fetch_array($result, MYSQL_ASSOC)
but to use mysql_fetch_assoc($result)
directly.
$res_arr_values = array();
while ($row = mysql_fetch_assoc($result))
{
$res_arr_values[] = $row;
}