- Code: Select all
<?php
include('phpgraphlib.php');
$graph = new PHPGraphLib(500,350);
$sonuc=array(0,0,0,1000,0,0,2000,0,0,0,0,0);
$graph->addData($sonuc);
$graph->setTitle('Widgets Produced');
$graph->setGradient('yellow', 'green');
$graph->createGraph();
?>
My code is working like that, but l wanna get the values from mysql, thats why l changed thecreating array part with below code
- Code: Select all
$date=date("Y-m-d");
$kk= date("m",strtotime($date));
$ss=date("Y",strtotime($date));
echo $date;
echo $ss."</br>";
$k=0;
while($k<12){
$i=0;
$results=mysql_query("SELECT * FROM new where month(date)='$kk' and year(date)='$ss' and erisim='1'");
while($sayi=mysql_fetch_array($results,MYSQL_ASSOC)){
$i++;
}
$sonuc[$k]=$i;
echo $sonuc[$k]."</br>";
$date = strtotime ( '+1 month' , strtotime ( $date ) ) ;
$date = date ( 'y-m-d' , $date );
$k++;
$kk= date("m",strtotime($date));
$ss=date("Y",strtotime($date));
}
but it's not working like this. They are creating the same array but when l do it using mysql, lt's not working. Please help me. If you want l can post phpgraphlib.php code too.




.Thanx. But still l cant draw a graph using values from mysql database.