Jump to content

Need help with a tutorial - syntax error


sanderphp

Recommended Posts

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(); ?>

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.