Can someone please cast a fresh pair of eyes over this simple piece of code. I am trying to populate two arrays with sales stats from a database for use with jgraph but something wierd is happening and I just can't see whats wrong. This code is set up to query the database for sales figures and populate two arrays, one for each store. The arrays are meant to be indexed using the week number from the query.
However, as it stands the array dump simply dumps 'Object:' for each element of both arrays.
<?php
function array_dump($arr){
foreach($arr as $key->$value){
echo $key.': '.$value.'<br>';
}
}
// Some data
include ('../connections/connTest.php');
$query = "SELECT WEEK(salesdate) as weekno, storeID, SUM((adjustedsales - vat)) as netsales
FROM daily_sales GROUP BY weekno, storeid ";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
$storeID = $row['storeID'];
$weekno = $row['weekno'];
$netsales = $row['netsales'];
if ($storeID == '32494'){
$y32494data[$weekno] = $netsales;
} elseif ($storeID == '32492') {
$y32492data[$weekno] = $netsales;
}
}
array_dump($y32492data);
array_dump($y32494data);
?>