Gazz1982 Posted July 21, 2007 Share Posted July 21, 2007 I have columns def,distance1,distance2,distance3,distance4,distance5,distance6,distance7,distance8,elevation1,elevation2,elevation3,elevation4, elevation5,elevation6,elevation7,elevation8,inclination1,inclination2,inclination3,inclination4,inclination5,inclination6,inclination7, inclination8,pan1....(to , plan1...(to , comments. I need to select all of the columns and arrage them in to groups so def is one group and distance another and elevation...etc all within the same graph, these would be coloured so distance1 would be the same colour as elevation1 etc... heres what i have so far <?php // Connecting, selecting database $link = mysql_connect('127.0.0.1', 'root', '') or die('Could not connect: ' . mysql_error()); //echo 'Connected successfully'; mysql_select_db('gary') or die('Could not select database'); // Performing SQL query // Retrieve all the data from the "example" table $sql = "SELECT def, count(*) AS def1 FROM answer GROUP BY def"; $result = mysql_query($sql); $data = array(); while (list($def, $def1) = mysql_fetch_row($result)) { $data[$def] = $def1; } include("phpgraphlib.php"); $graph=new PHPGraphLib(400,300); //$data=array("1"=>$def1, "2"=>198, "3"=>70, "4"=>90); $graph->addData($data); $graph->setTitle("Definitions"); $graph->setGridColor("153,204,255"); $graph->setGradient("red", "maroon"); $graph->setBarOutlineColor("black"); $graph->setTextColor("blue"); $graph->createGraph(); // Closing connection mysql_close($link); ?> Link to comment https://forums.phpfreaks.com/topic/61047-selecting-multiple-columns-in-the-same-table-for-a-graph/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.