Jonas - what do you mean 'it doesn't work'

(it's like me saying 'the ATM doesn't work and
forgetting to mention I'm trying to withdraw 10,000,000
disney dollars - when I mention that fact the reason is probably
obvious to you why it doesn't work)

Brad Bonkoski wrote:
What kind of values are stored in $row[2] and $row[5]?

You might need to keep the single quotes....
$test['$row[2]'] = $row[5];

no this is wrong, unless you want the array key in this case to be
the *exact* *literal* string '$row[2]' - which is unlikely.

Jonas do the following (in the relevant place in your code)
and see what is in $row:

var_dump($row);


-Brad

Jonas Rosling wrote:

There's allways mutch to learn. :-) I'm very happy for all help I can get.
I ran into another problem when trying to insert a value.
I had no problem with:

   $test['something'] = '2500';

But when I want to have a value from a special column i a row the followint
doesn't work:

   $test[$row[2]] = $row[5];

Or:

   $test[$row(2)] = $row[5];

Do I need to do some kind of concatenating?

Thanks again // Jonas



Den 06-05-03 15.46, skrev "Jochem Maas" <[EMAIL PROTECTED]>:

Jonas Rosling wrote:
Need solve another case regarding array maps. Is it possible to insert more

Jonas - in php we just call these things arrays (no 'map') - the array
datatype in php is a mash up (and we love it :-) of the 'oldschool'
numerically
indexed array and what is commonly known as a hash (or arraymap) - you can mix numeric and associative indexes freely (that might seem odd and/or bad when
coming
from another language but it really is fantastic once you get your head round
it).

values like with array_push in arrays as bellow?

$colors = array(
             'red' => '#ff0000',
             'green' => 'X00ff00',
             'blue' => '#0000ff'
          );


sure:

$colors['grey'] = '#dedede';

the position of the 'inserted' (actually appended) is often not
important - if it is there are plenty of functions that allow you to
manipulate
arrays in more a complex fashion e.g. array_splice(). and all sorts of sorting
functions are also available e.g. asort().

check out the vast number of array related function and introductory texts
here:

http://php.net/array
http://php.net/manual/language.types.array.php

Tanks in advance // Jonas







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to