Good morning everyone, Kinda got stuck here. Must be brain dead this morning. I'm trying to loop thru a results set from a mysql query that will always return an array of 13 results. I need to loop thru using a while statement and create dynamic variables $temp1 - $temp13 and $tempcolor1 - $tempcolor13 to assign values to each of these variables as I loop thru. Here's the code, please review and advise, suggest whatever. This script is used to build a line graph in php from the data in the $temp variables.
$counter = "0"; //loop thru wells to create line plots while( $row = mysql_fetch_array( $query ) ) { //define global $temp="ydata$counter"; global $$temp; $tempcolor="ydata$counter"; global $$tempcolor; // Create the linear plot $ydata = explode(",", $row[CurveData]); $$temp = $ydata; //Set Line Plot Color $lineplot->SetColor("$color[$counter]"); $$tempcolor = $lineplot; //add 1 to counter $counter = $counter + 1; } //define lines $lineplot0=new LinePlot($temp0); $lineplot1=new LinePlot($temp1); $lineplot2=new LinePlot($temp2); $lineplot3=new LinePlot($temp3); $lineplot4=new LinePlot($temp4); $lineplot5=new LinePlot($temp5); $lineplot6=new LinePlot($temp6); $lineplot7=new LinePlot($temp7); $lineplot8=new LinePlot($temp8); $lineplot9=new LinePlot($temp9); $lineplot10=new LinePlot($temp10); $lineplot11=new LinePlot($temp11); $lineplot12=new LinePlot($temp12); //set colors $lineplot0->SetColor("$tempcolor0"); $lineplot1->SetColor("$tempcolor1"); $lineplot2->SetColor("$tempcolor2"); $lineplot3->SetColor("$tempcolor3"); $lineplot4->SetColor("$tempcolor4"); $lineplot5->SetColor("$tempcolor5"); $lineplot6->SetColor("$tempcolor6"); $lineplot7->SetColor("$tempcolor7"); $lineplot8->SetColor("$tempcolor8"); $lineplot9->SetColor("$tempcolor9"); $lineplot10->SetColor("$tempcolor10"); $lineplot11->SetColor("$tempcolor11"); $lineplot12->SetColor("$tempcolor12"); //ad lines $graph->Add($lineplot0); $graph->Add($lineplot1); $graph->Add($lineplot2); $graph->Add($lineplot3); $graph->Add($lineplot4); $graph->Add($lineplot5); $graph->Add($lineplot6); $graph->Add($lineplot7); $graph->Add($lineplot8); $graph->Add($lineplot9); $graph->Add($lineplot10); $graph->Add($lineplot11); $graph->Add($lineplot12); HELP!!!! -------------------------- D. Robert Trembath Chief Software Engineer Bacterial BarCodes Inc. e|[EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php