|
Posted by pauld on 12/20/05 14:01
Thanks. adding the error reporting gives me a load of stuff about array
indiceds not defined. i thought PHP dynamically sorted out array
lengths. is there a 'better' way to do it than just let the scriptsort
it out ?
I want my results to end up as
results[0] => date,ID,value
results[1] => date,ID,value
results[2] => date,ID,value
etc etc
( there is probably a better way of resetting the temparray but ive
not found it !)
$i=0;
while ($a2=mysql_fetch_assoc($a1))
{$temparray=array();
array_push($temparray,$a2['ID'].$a2['date'],$a2['value']);
$results[$i] = array($temparray);
if (isset($temparray)) {reset($temparray);}
print '<br>'.$i.':';
print_r($results[$i]).'<br>';
$i=$i++;
}
gives
0:Array ( [0] => Array ( [0] => 2005-10-07 [1] => 350 [2] => 21 ) )
0:Array ( [0] => Array ( [0] => 2005-10-28 [1] => 473 [2] => NC2 ) )
0:Array ( [0] => Array ( [0] => 2005-10-03 [1] => 337 [2] => NC4 ) )
dont know why the $i counter is incrementing the array
Navigation:
[Reply to this message]
|