Jump to content

selecting multiple columns


Gazz1982

Recommended Posts

Ok, I have created an updating graph by using the following code (after connecting to the db) but i cant seem to select from more than 1 column, any help?

 

$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/61052-selecting-multiple-columns/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.