note 95870 rejected from function.array-push by danbrown

From: Date: Tue, 26 Jan 2010 22:26:10 +0000
Subject: note 95870 rejected from function.array-push by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165339@lists.php.net to get a copy of this message
Note Submitter: champton at samaritan dot org ---- I want to create an array push for multiple keys and assign a value for each key from a database query. This is my code: $array = array( key1 => val1, key2 => val2, key3 => val3, ); $x = 1; while($r = mysql_fetch_array($items)) { array_push($array, 'key'.$x => $r[field1]); } I hope this makes sense. Thanks in advance.

« previous php.notes (#165339) next »