set_extrema(0, 1, 400, 1000); $colors = array("black","blue","red","green","khaki","gold","chocolate","brown","salmon","orange","pink","magenta","yellow"); $inc = 0; if (isset($_GET['check'])) { foreach($_GET['check'] as $id) { $inc = $inc + 1; $query = "SELECT * FROM $table WHERE $table.`id` = $id LIMIT 1;"; $result = mysql_query($query) or die("Invalid query: " . mysql_error()); $x = explode(";", mysql_result($result,0,"x")); $y = explode(";",mysql_result($result,0,"y")); $j = 0; unset($data2); unset($data1); WHILE ($j < count($x)) { $data2[$j] = $x[$j]; $data1[$j] = $y[$j]; $j = $j + 1; } $chart->plot($data1, $data2, $colors[$inc]); $chart->add_legend($id, $colors[$inc]); } } $chart->stroke(); ?>