tags:

views:

140

answers:

2

I hope it's the heat, this is the second question today and it's one problem after the other. Relatively simple stuff...

I have this query ...

while ($resultV = mysql_fetch_assoc($metQueryViews)) { $allViews[] = $resultV; }

The date it's getting is:-

date        Count
NULL         6
14-5-2009   12
15-5-2009   21
26-6-2009   18
29-6-2009   61

I'm trying to build an array, that reads out

"14-5-2009" = > "12"

But, the above while statement produces what seems to be a multi-dimensional array or sommet, which has the field name => value.

Thoughts on a little post card are most welcome.

+5  A: 
$allViews[] = array($resultV["date"] => $resultV["count"]);
Jonathan Sampson
spot on, thanks Jonathan
WiseDonkey
No problem, man. Welcome to SOFlow!
Jonathan Sampson
A: 
$allViews = array();
while (list($date, $count) = mysql_fetch_row($metQueryViews)) {

    $allViews[$date] = $count;
}
Matt Bridges