[PHP] Greate day for you,

2010-04-07 Thread Chris G
http://sites.google.com/site/vfgbyuhoi6/kewe2w

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] array problems

2006-08-16 Thread Chris G

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


[PHP] Please help me with in_array

2006-08-04 Thread Chris G

Hi all

I have been stuck on this problem for 4 hours. Please anyone that can help
here I would appreciate it.

If I print_r($_GET) I have

Array ([question] = Array ( [10] = 1 [11] = 2 [12] = 1 [13] = 1)'


So now I try

foreach($_GET['question'] as $key) {
 if(!in_array($key, $_SESSION['question'])) {
  print not matched lets updatebr.
$_GET[question][$key]; // HERE I WANT IT TO SHOW $key
is 10 and its value should be 1 (as printed in the Array above)
 }
else {
 print matched;
 }
}



Where it gets to the section not matched I need to print out from the
question array question[$key][$value] (question '10' = '1' as above)



I am not sure if I am even making sense here anymore...

Thanks in advance


Chris