tags:

views:

32

answers:

2

I have a mysql statement which returns 2 values for each row.

Each time I loop through these results, i want to add them to an array.

I want one value to be the key, and the other to be the array value.

I tried this, but it doesn't seem to work:

$dataarray[] = $row['id']=>$row['data'];
+7  A: 

Why not just use

$dataarray[$row['id']] = $row['data'];

?

KennyTM
+3  A: 
$dataarray[ $row['id'] ] = $row[ 'data' ];
Discodancer