Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Can't get the include path correct

Links for php scripts

Moderators: macek, egami, gesf

Can't get the include path correct

Postby jellis00 » Thu Nov 17, 2011 1:38 am

I have a .php page installed on my website at . I have included the scripts shown below in the code on this page. I am trying to include the use of a libchart.php file that is located in a sub-directory that is also located in the iChip folder, but from the error messages I am getting on the server side, it appears I don't have the path to this libchart.php file correct in the syntax. Therfore it isn't creating the line chart that the libchart.php file is suppose to create on the web page.

Can anyone look at the error messages shown on my sebsite page and this script code and tell me what I am doing wrong?
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">

<meta content="text/html" charset="utf-8" http-equiv="refresh" content="150" />

$myFile = "include-2.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
echo "<br />";
echo "<br />";
$temperature_array[0] = "50";
$temperature_array[1] = "55";
$temperature_array[2] = "60";
$temperature_array[3] = "65";
echo "TemperaturePoint0 - " . $temperature_array[0] . "<br />";
echo "TemperaturePoint1 - " . $temperature_array[1] . "<br />";
echo "TemperaturePoint2 - " . $temperature_array[2] . "<br />";
echo "TemperaturePoint3 - " . $temperature_array[3] . "<br />";
echo "Current temperature is " . $theData . " degrees F";
include ('/libchart/classes/libchart.php');

   $chart = new LineChart(500, 250);

   $serie1 = new XYDataSet();
   $serie1->addPoint(new Point("06-01", 273));
   $serie1->addPoint(new Point("06-02", 421));
   $serie1->addPoint(new Point("06-03", 642));
   $serie1->addPoint(new Point("06-04", 799));
   $serie1->addPoint(new Point("06-05", 1009));
   $serie1->addPoint(new Point("06-06", 1106));
   $serie2 = new XYDataSet();
   $serie2->addPoint(new Point("06-01", 280));
   $serie2->addPoint(new Point("06-02", 300));
   $serie2->addPoint(new Point("06-03", 212));
   $serie2->addPoint(new Point("06-04", 542));
   $serie2->addPoint(new Point("06-05", 600));
   $serie2->addPoint(new Point("06-06", 850));
   $dataSet = new XYSeriesDataSet();
   $dataSet->addSerie("Product 1", $serie1);
   $dataSet->addSerie("Product 2", $serie2);
   $chart->setTitle("Sales for 2006");


New php-forum User
New php-forum User
Posts: 20
Joined: Fri Nov 11, 2011 12:47 pm

Re: Can't get the include path correct

Postby lonelygirl86 » Mon Jan 09, 2012 6:02 pm

remove the / in the include function. make it just like this
Code: Select all

something like that. And, please check your directory structure. check where did you put your file.
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 09, 2012 12:05 am

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.