JamesFlowers
Programmer
select country, count(customerNumber) Customers from customers group by country
I am trying to devleop a PHP page to show the above data from a MySQL DB.
each time I do a straight select , it works , but with the count, it crashes out.
returning
'Parse error: syntax error, unexpected T_EXIT in /mounted-storage/home131/sub036/sc71786-KNVR/websitenameremoved.com/php/graph.php on line 9
this is my code so far Im not worried about the graph not working yet...
<?php
include ("src/jpgraph.php");
include ("src/jpgraph_bar.php");
$db = mysql_connect('detailsremoved') or die(mysql_error());
mysql_select_db("ERP_RA",$db) or die(mysql_error());
$sql = mysql_query("select country Customers from customers group by country") die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$data[] = $row[1];
$leg[] = $row[0];
}
$graph = new Graph(250,150,"auto");
$graph->SetScale("textint");
$graph->img->SetMargin(50,30,50,50);
$graph->AdjBackgroundImage(0.4,0.7,-1); //setting BG type
$graph->SetBackgroundImage("linux_pez.png",BGIMG_FILLFRAME); //adding image
$graph->SetShadow();
$graph->xaxis->SetTickLabels($leg);
$bplot = new BarPlot($data);
$bplot->SetFillColor("lightgreen"); // Fill color
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
$bplot->value->SetAngle(45);
$bplot->value->SetColor("black","navy");
$graph->Add($bplot);
$graph->Stroke(); ?>
thanks
James Flowers
Crystal Consultant
I am trying to devleop a PHP page to show the above data from a MySQL DB.
each time I do a straight select , it works , but with the count, it crashes out.
returning
'Parse error: syntax error, unexpected T_EXIT in /mounted-storage/home131/sub036/sc71786-KNVR/websitenameremoved.com/php/graph.php on line 9
this is my code so far Im not worried about the graph not working yet...
<?php
include ("src/jpgraph.php");
include ("src/jpgraph_bar.php");
$db = mysql_connect('detailsremoved') or die(mysql_error());
mysql_select_db("ERP_RA",$db) or die(mysql_error());
$sql = mysql_query("select country Customers from customers group by country") die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$data[] = $row[1];
$leg[] = $row[0];
}
$graph = new Graph(250,150,"auto");
$graph->SetScale("textint");
$graph->img->SetMargin(50,30,50,50);
$graph->AdjBackgroundImage(0.4,0.7,-1); //setting BG type
$graph->SetBackgroundImage("linux_pez.png",BGIMG_FILLFRAME); //adding image
$graph->SetShadow();
$graph->xaxis->SetTickLabels($leg);
$bplot = new BarPlot($data);
$bplot->SetFillColor("lightgreen"); // Fill color
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
$bplot->value->SetAngle(45);
$bplot->value->SetColor("black","navy");
$graph->Add($bplot);
$graph->Stroke(); ?>
thanks
James Flowers
Crystal Consultant