note 75378 added to ref.array

From: Date: Fri, 25 May 2007 21:40:13 +0000
Subject: note 75378 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-126910@lists.php.net to get a copy of this message
@spasme: You are mistakenly using the "=>" notation outside of an "array()" statement. You can say "$x = array ($key => $value);", but to add a value/key pair to an array you need to say "$x[$key] = $value;" Thus your command should look like this: while ($qry = mysql_fetch_array($result)) { days[$qry[day]] = array ('#link', 'linked-day'); } (I trust you to know what you want to achieve with '#link', 'linked-day') ---- Server IP: 129.16.214.50 Probable Submitter: 85.231.175.29 ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- https://master.php.net/note/edit/75378 Del: integrated -- https://master.php.net/note/delete/75378/integrated Del: useless -- https://master.php.net/note/delete/75378/useless Del: bad code -- https://master.php.net/note/delete/75378/bad+code Del: spam -- https://master.php.net/note/delete/75378/spam Del: non-english -- https://master.php.net/note/delete/75378/non-english Del: in docs -- https://master.php.net/note/delete/75378/in+docs Del: other reasons-- https://master.php.net/note/delete/75378 Reject -- https://master.php.net/note/reject/75378 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126910) next »