182x Posted June 26, 2007 Share Posted June 26, 2007 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(); ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 $sql = mysql_query("SELECT * FROM students") die(mysql_error()); needs to be $sql = mysql_query("SELECT * FROM students") or die(mysql_error()); its seeing the die and wondering why you wanna exit Quote Link to comment Share on other sites More sharing options...
182x Posted June 26, 2007 Author Share Posted June 26, 2007 Thanks so much, can't believe it was something to simple! Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 26, 2007 Share Posted June 26, 2007 use a text editor that gives you line numbers and follow your errors it saves you and me time Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.