Jump to content

[SOLVED] Code error


182x

Recommended Posts

Hey guys,

 

I was trying to get the jpgraph software to work but when I use the following code I get an error that suggests  there is a problem with the database, I was just wondering how to fix it? thanks.

 

error message: Parse error: syntax error, unexpected T_EXIT in C:\xampp\htdocs\graphTest\test.php on line 9

 

Code used:

 

<?php
include ("c:/jpgraph/src/jpgraph.php");
include ("c:/jpgraph/src/jpgraph_bar.php");

$db = mysql_connect("localhost", "root","") or die(mysql_error());

mysql_select_db("student",$db) or die(mysql_error());

$sql = mysql_query("SELECT * FROM students") 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->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();

?>

 

Link to comment
https://forums.phpfreaks.com/topic/57298-solved-code-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.