Jump to content

array trouble


182x

Recommended Posts

Hey guys, I have been using the following code to put data from a query into the arrays as shown below.

 

However there will be some cases where the data will have to be calculated from the one or more queries and stored in an array before the while loop can be performed. So I was wondering how do you perform the same while loop but with the results stored in an array as the mysql_fetch_array would not work?

 

mysql_select_db("gra",$db) or die(mysql_error());
$query = mysql_query("SELECT name, count(*) FROM gra group by name") or die(mysql_error());

while($getData = mysql_fetch_array($query)){
	$points[] = $getData[1];
	$months[] = $getData[0];
}

Link to comment
https://forums.phpfreaks.com/topic/60337-array-trouble/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.