[PHP-DB] Arrays again again

2002-11-13 Thread Martin Allan Jensen
Sorry fellers Allready figured it outsorrynow i see that the question was foolish Anyway now i need help with something else... I now have some values: 320 - 250 - 290 - 100 And years that fits to them: 2002 - 2003 - 2004 - 2005 How can i put these dynamic values in a

Re: [PHP-DB] Arrays again again

2002-11-13 Thread Marco Tabini
Perhaps I don't understand what it is you're looking for, but... $a = array(); for ($i = 0; $i $maxvalue; $i++) { $a[$year] = $value; } but this is almost too simple, which probably just means I didn't quite understand your question. Marco -- php|architect - The magazine

Re: [PHP-DB] Arrays again again

2002-11-13 Thread Peter Beckman
The problem there is that you've got $a[$year] getting set a bunch of times. That is busted code. $a[$year] will only contain the LAST value. Replace that line with this one. $a[] = array(year=$year, value=$value); OR $a[$i] = array(year=$year, value=$value); Now $a[0][year] = 2002