please help me im dying on it

//Include the code
include("phplot-5.0.5/phplot.php");

//Get the data from database
$dbhost="localhost";
$dbuser="root";
$dbpass="";
$dbname="simpati_unkhair";

$dblink=mysql_connect($dbhost,$dbuser,$dbpass);
$sql=mysql_db_query($dbname, "select * from sale");
$num=mysql_num_rows($sql); //menentukan xmax, bisa juga ditambahkan cari ymax
while(list($bulan,$jumlah)=mysql_fetch_array($sql))
{
 $data[] =array("$bulan",$jumlah);
}

//Define the object
$graph = new PHPlot(700,400);

$graph->SetPlotAreaWorld(0,0,$num,60); // xmax ->$num
$graph->SetTitle("Contoh Grafik Batang");
$graph->SetVertTickPosition('plotleft');
$graph->SetSkipBottomTick(1);
$graph->SetDataValues($data); //data berupa array
$graph->SetDrawYGrid(1);
$graph->SetPlotType('bars');
$graph->SetDrawDataLabels('1');
$graph->SetLabelScalePosition('1');
$graph->SetDataColors(array("blue"));
$graph->SetMarginsPixels(50,50,50,50);

//Draw it
$graph->DrawGraph();

mysql_close($dblink);

error like this :
Fatal error: Cannot use object of type stdClass as array in C:\Program Files\xampp\htdocs\simpati_unkhair\PEJABAT\REKTORAT\file\file.grafikmhsperfak.php on line 16

Comments

nedjo’s picture

Status: Active » Closed (fixed)

This question is not related to PHP variables module or any other module. Pls repost as a forum topic in the "support" forum.