Page 1 of 1

Can array_push be used to push onto an associative array?

Posted: Tue May 22, 2007 10:41 am
by impulse()
My array is empty at the moment but I want results from a DB to be pushed onto the end of it using http://uk.php.net/manual/en/function.array-push.php?

If not how is this possible another way?


Regards,

Posted: Tue May 22, 2007 10:45 am
by impulse()
Sorry, I realised I was being silly as soon as I posted this.

This is what I was looking to do (no need for array_push).

Code: Select all

while ($res = mysql_fetch_array($queryData))
  $productsData[$res['groupID']] = $res['groupName'];

Posted: Tue May 22, 2007 10:50 am
by feyd
That's not even a 3D array. It's a linear, associative array.