$dataArray=array();
$sql="SELECT periodo_fattura, COUNT(fattura) AS 'count', lettura.* FROM lettura WHERE codice = ".$codice."";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if($result)
{
while($row = mysql_fetch_assoc($result))
{
$salesgroup=$row["periodo_fattura"];
$count=$row["count"];
//ADD TO ARRAY
$dataArray[$row["fattura"]]=$count;
}
}
include("inc/phpgraphlib.php");
$graph=new PHPGraphLib(300,300);
$graph->addData($dataArray);
$graph->setTitle("Valori casuali per ogni mese");
$graph->setTextColor("red");
$graph->createGraph();