sandy1028 Posted September 21, 2007 Share Posted September 21, 2007 $graphValues=array(); //Some code $qry1=mysql_query($qry); while($qry2=mysql_fetch_array($qry1)){ $graphValues[] =$qry2[0]; How to store the values of $qry2[0] into the $graphValues The values should be stored in $graphValues=array(1,34,564,763,6754.............) I am not able to store the values into $graphValues Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/ Share on other sites More sharing options...
teng84 Posted September 21, 2007 Share Posted September 21, 2007 do this first for checking purpose print_r(mysql_fetch_array($qry1)); and post the result Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352089 Share on other sites More sharing options...
sandy1028 Posted September 21, 2007 Author Share Posted September 21, 2007 The result is like this Array ( [0] => 0.01248649 [avg(bw_util)] => 0.01248649 ) Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352091 Share on other sites More sharing options...
sandy1028 Posted September 21, 2007 Author Share Posted September 21, 2007 Array ( [0] => 0.01248649 [avg(bw_util)] => 0.01248649 ) Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352092 Share on other sites More sharing options...
teng84 Posted September 21, 2007 Share Posted September 21, 2007 may we see your query? Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352093 Share on other sites More sharing options...
sandy1028 Posted September 21, 2007 Author Share Posted September 21, 2007 select avg(bw_util) from `tablename` where `fieldname` < now() and `fieldname` > date_sub(now(),interval 1 day) group by `fieldname` Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352098 Share on other sites More sharing options...
teng84 Posted September 21, 2007 Share Posted September 21, 2007 i guess fetch assoc is what you need $qry="select avg(bw_util) as average_list from `tablename` where `fieldname` < now() and `fieldname` > date_sub(now(),interval 1 day) group by fieldname" ; $qry1=mysql_query($qry); print_r(mysql_fetch_assoc($qry1)); so you have like $result = mysql_fetch_assoc($qry1); Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352103 Share on other sites More sharing options...
sandy1028 Posted September 21, 2007 Author Share Posted September 21, 2007 Array ( [avg(bw_util)] => 0.02123514 ) The output is like this. I just want the values in $qry2[0] as an array. How to push the values in $qry2[0] to $graphValues. Quote Link to comment https://forums.phpfreaks.com/topic/70097-arrays/#findComment-352108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.