array problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

Having a prob with a php script...

3 arrays

$datay1=array(140,110,50,60);

$datay2=array(35,90,190,190);

$datay3=array(20,60,70,140);

which have to be passed to a class like this

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));

if I get data from a database, how can I automatically increment the $datay

arrays..... for instance

currently with my loop that follows, I am only creating one array

($data1y) - but I now need to create various from user input.

$query = "SELECT rep_value_perc FROM report_values WHERE rep_l_per_id =

'$_GET[per_id]'";

$result = mysql_query($query) or die (mysql_error());

while($line = mysql_fetch_array($result)) {

$data1y[] = $line['rep_value_perc'];

}

This gives me just the one array from the above example, $datay1. How would

you dynamically create the all of the above arrays?

At present the $_GET[per_id] is only one value $_GET[per_id] = 2

What happens when it becomes more than one, like $_GET[per_id] = array

(1,2,34,4,561,334)

If I need to assign each one of the $_GET[per_id] a new $data array variable

in the loop above how would you do it?

Am I making sense?

Thanks to anyone that reads this...

Regards

Chris

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux