Re: irrational behavior

From: Date: Tue, 12 May 2009 15:27:10 +0000
Subject: Re: irrational behavior
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-292497@lists.php.net to get a copy of this message
2009/5/12 PJ <af.gourmet@videotron.ca>: > Could somebody please explain this? > When the line - sort($category) is commented out, the output returns > Notice: Undefined offset: in the line "36" for all the repeats (29 in > this case) Sure thing if you consider this: > The code below: > <? > $SQL = "SELECT name > FROM categories ORDER BY category_id > "; > $category = array(); > //[...] > $category[$row['name']] = $row; > //[...] while > $cat = $category[$ii]['name']; //=======this is line 36========== > After setting only $arr[NAMEfromDB], why should be a numeric index $arr[INT] ? Now just do var_dump($category) before and after your sort() - But I don't see why you still have it, when the query itself does the sorting. Regards

« previous php.general (#292497) next »