It display "No database selected".....
Anyone who know what the problem of these statement???
Code: Select all
<?php
include ("c:/jpgraph-1.12.2/src/jpgraph.php");
include ("c:/jpgraph-1.12.2/src/jpgraph_bar.php");
$sql = mysql_query("select 1998,sum(noofpassenger),sum(noofcompany) from info where departuredate like '1998%'") or die(mysql_error());
echo $sql;
while($row = mysql_fetch_array($sql))
{
$data1y[] = $row[1];
$data2y[] = $row[2];
$leg[] = $row[0];
}
// Create the graph. These two calls are always required
$graph = new Graph(310,200,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,40);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Example 21");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->xaxis->SetTickLabels($leg);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke();
?>