storing mysql query results in an array
Posted: Sun Dec 03, 2006 11:34 am
Hi,
I'm trying to incorporate a chart class in my PHP script.
The chart class requires that series labels are defined like this:
or like this:
In my case series labels should come from a database and I'm having trouble creating an array from the results of the query that I could use for this purpose.
I'm using the following code:
Then I try to use
However, instead of the label names the text "Array" appears.
What am I doing wrong?
I'm trying to incorporate a chart class in my PHP script.
The chart class requires that series labels are defined like this:
Code: Select all
$graph->labels = "Jan.,Feb.,Mar.,Apr.,May";Code: Select all
$graph->values = array("Jan.,Feb.,Mar.,Apr.,May");I'm using the following code:
Code: Select all
while($row=mysql_fetch_array($results)) {
$array_labels[] = array($row['labels']);
}Code: Select all
$graph->values = $array_labels;What am I doing wrong?