In general, there is a query to the database, it returns a multidimensional array, then I spend it through the function mysql_fetch_accos, it becomes associative.

In general, I need to collect a new array from it, but only that the id would be only id, and not the heap that I requested in the request.

The problem is that print_r ($ ids) = last value

for ($i = 0; $i < count($people); ++$i) { $ids[$i] = $people[$i]['id']; } 

    1 answer 1

      $ids=array(); $query="SELECT * FROM ..."; $result=mysql_query($query); while($item=mysql_fetch_assoc($result)){ $ids[] = $item['id']; } print_r($ids);