[PHP-DB] Arrays again

2002-11-13 Thread Martin Allan Jensen
Hi everyone, I need a little help again I have a array with 4 values: 320 - 570 - 860 - 960 Each time it extracts one value it's supposed to take minus it with the old value. So that the output for the array above would be: 320 - 250 - 290 - 100 I hope you get the point and you're able

[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