", "") or die("Could not connect : " . mysql_error()); /* Select Database testDB */ mysql_select_db('testDB',$link) or die("Could not select database"); /* Performing SQL query for Product X*/ $query = "Select Value from SalesBar where Year=2003 and Product='X' ORDER BY Quarter"; $result1 = mysql_query($query) or die("Query failed : " . mysql_error()); /* Performing SQL query for Product Y*/ $query = "Select Value from SalesBar where Year=2003 and Product='Y' ORDER BY Quarter"; $result2 = mysql_query($query) or die("Query failed : " . mysql_error()); /* Performing SQL query for Product Z*/ $query = "Select Value from SalesBar where Year=2003 and Product='Z' ORDER BY Quarter"; $result3 = mysql_query($query) or die("Query failed : " . mysql_error()); /* Output the data in the correct format for the graph */ $data_num = 1; while ($line = mysql_fetch_array($result1, MYSQL_ASSOC)) { foreach ($line as $col_value) { print "data".$data_num."series1: ".$col_value."\n"; } $data_num = $data_num +1; } $data_num = 1; while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) { foreach ($line as $col_value) { print "data".$data_num."series2: ".$col_value."\n"; } $data_num = $data_num +1; } $data_num = 1; while ($line = mysql_fetch_array($result3, MYSQL_ASSOC)) { foreach ($line as $col_value) { print "data".$data_num."series3: ".$col_value."\n"; } $data_num = $data_num +1; } ?>