sanderphp Posted April 24, 2008 Share Posted April 24, 2008 I'm getting an error Parse error: syntax error, unexpected T_EXIT in /home/sanderan/public_html/php/tutorial/graph.php on line 6 I am working through the graphing tutorial and am a very big noob. Is there a code error on line 6? <?php include 'jpgraph.php'; include 'jpgraph_bar.php'; $db = mysql_connect("localhost", "sanderan_usernam","password") or die(mysql_error()); mysql_select_db("sanderan_tutorial",$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->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(); ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted April 24, 2008 Share Posted April 24, 2008 You didn't put the "or" before the "die". So change this line: $sql = mysql_query("SELECT * FROM students") die(mysql_error()); To $sql = mysql_query("SELECT * FROM students")or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
sanderphp Posted April 24, 2008 Author Share Posted April 24, 2008 ah... that's what I get for copying the code out of the example. I fixed that but now I'm getting Warning: require_once(jpg-config.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/sanderan/public_html/php/tutorial/jpgraph.php on line 11 Fatal error: require_once() [function.require]: Failed opening required 'jpg-config.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sanderan/public_html/php/tutorial/jpgraph.php on line 11 I put the jpgraph.php and jpgraph_bar.php files in the same directory as this php file. The error refers to usr/lib/php but I'm not sure if I need to set something up there or if I would do this via CPanel. 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.