Parse error: syntax error, unexpected T_SL in C:\AppServ\www\graphtest.php on line 15

$sql = <<<EOS   this have problem......but what is it?
also $conn->Connect('localhost', 'root', '1234567', 'zend');

'zend ' what is this filed i should input?
i use Jpgraph ~ php4
if (USE_DB) { 
    // establish a connect to the database 
    $conn = &ADONewConnection('mysql'); 
    $conn->Connect('localhost', 'root', '1234567', 'zend'); 
    // make an sql statement to retrieve the data you want 
   $sql = <<<EOS 
    SELECT dt, 
        MONTHNAME(dt) AS mon, 
    FROM data 
    WHERE dt >= '2002-01-01' 
        AND dt < '2003-01-01' 
    ORDER BY dt ASC 
    // create a result set by executing your sql over the connection 
    $rs = $conn->Execute(trim($sql)); 
    // iterate over the result set and create $data arrays 
    while ($rs && !$rs->EOF) { 
        $row = $rs->fields; 
        $labelx[] = substr($row['mon'],0,3); 
        $data['plan'][] = $row['plan']; 
        $data['actual'][] = $row['actual']; 
        $data['forecast'][] = $row['forecast']; 
} else { // USE_DB false 
    $data['plan'] = array (  
            11.5, 12, 12, 13.5, 10, 9.5,  
            11, 12, 12, 11, 13, 12.5 ); 
    $data['actual'] = array(  
            12, 14, 14.5, 13, 9, 4,  
            0, 0, 0, 0, 0, 0 ); 
    $data['forecast'] = array (  
            0, 0, 0, 0, 0, 10,  
            12, 14, 13, 10, 11, 13 ); 
    for($i = 0; $i < count($data['actual']); $i++) { 
        $labelx[] = strftime('%b',  
                mktime(0, 0, 0, $i+1, 1, date('Y'))); 
// create the "good" and "bad" series for our red/green look 
for($i = 0; $i < count($data['actual']); $i++) { 
    if ($data['actual'][$i] >= $data['plan'][$i]  
        || $data['forecast'][$i] >= $data['plan'][$i]) { 
        $data['good'][$i] = $data['actual'][$i]; 
        $data['bad'][$i] = 0; 
    } else { 
        $data['good'][$i] = 0; 
        $data['bad'][$i] = $data['actual'][$i]; 
// set title and name for the chart 
$title = date('Y').' Plan vs Actual & Forecast'; 
$graph_name = 'chart.png'; 
* JpGraph - Step 1 
* Create the graph object and set general parameters 
// set general graph details 
$graph = new graph(450, 300, $graph_name, 0, false); 
//    margins, background color, scale and shadow for the whole graph 
$graph->img->SetMargin(50, 30, 30, 80); 
//    set the title and font 
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14); 
//    set the y-axis and title it 
$graph->yaxis->title->Set('Units in Thousands'); 
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); 
//    set the x-axis, labels and title it 
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 8); 
//    set the graph title and font 
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); 
* JpGraph - Step 2 
* Set the individual plot details 
// line1 is the plan data line, green, thick and marked with circles 
$line1 = new LinePlot($data['plan']); 
// bar1 is the green bars for actual or forecast above plan 
$bar1 = new BarPlot($data['good']); 
$bar1->SetLegend('Actual above Plan'); 
// bar2 is the red bars for actual and forecast below plan 
$bar2 = new BarPlot($data['bad']); 
$bar2->SetLegend('Actual below Plan'); 
// bar3 is the gray bars for forecast data 
$bar3 = new BarPlot($data['forecast']); 
* JpGraph - Step 3 
* Finalize and output the graph 
// set legend details 
$graph->legend->Pos(0.52, 0.85, 'center'); 
// add the graphs bottom to top 
// output the graph to cache 
$page_title = 'Zend Graphing Tutorial'; 
/*    another example not covered in the tutorial, 
    output the data series values 
    into a table below the graph 
for($i = 0; $i < count($data['actual']); $i++) { 
    $row_head .= '<th>'.$labelx[$i].'</th>'; 
    $row_plan .= '<td>'.number_format($data['plan'][$i], 1).'</td>'; 
    $row_act  .= '<td>'.number_format($data['actual'][$i], 1).'</td>'; 
    $row_fcst .= '<td>'.number_format($data['forecast'][$i], 1).'</td>'; 
print <<<EOS 
<div style="text-align: center"> 
<img src="{$jpgcache}{$graph_name}" /> 
<p /> 
<table border="1" cellpadding="5" cellspacing="0"> 
<tr align="center"><th>Data</th>$row_head</tr> 
<tr align="right"><td><b>Plan</b></td>$row_plan</tr> 
<tr align="right"><td><b>Actual</b></td>$row_act</tr> 
<tr align="right"><td><b>Forecast</b></td>$row_fcst</tr> 

Open in new window

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

agamalConnect With a Mentor Commented:
also i tried the attached code and i got

Invalid query: No database selected

mysql_connect('localhost','root','root','test') or die('Could not connect: ' . mysql_error());
$res = mysql_query('select * from users') or die('Invalid query: ' . mysql_error());

Open in new window

Ionut A. TudorPHP ProgrammerCommented:
for your first question it is a heredoc syntax EOF not EOS
$sql = <<<EOF
    SELECT dt,
        MONTHNAME(dt) AS mon,
    FROM data
    WHERE dt >= '2002-01-01'
        AND dt < '2003-01-01'
this is the correct use, with any spaces after EOF
For your second question `zend` is your database name.
Hope this helps
Terry WoodsIT GuruCommented:
The error is caused by the space character after the EOS on this line:

   $sql = <<<EOS 

Open in new window

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

i belive the guys here have answered your first Q ... but i have a comment on the second Q

the zend value here called new_link
"If a second call is made to mysql_connect()        with the same arguments, no new link will be established, but        instead, the link identifier of the already opened link will be        returned. The new_link  parameter modifies this         behavior and makes mysql_connect() always open         a new link, even if mysql_connect() was called         before with the same parameters.        In SQL safe mode, this parameter is ignored.       "

unless your connect function has different structure
ftpphptest1Author Commented:
what is the meaning ?
as i find that there many sytax error...
Guy Hengel [angelIII / a3]Billing EngineerCommented:
we need to see the function connect() code
ftpphptest1Author Commented:
do u have any other example showing data in MySQL to the line chart ?

differnet element vs time line chart
if you want to make graph   ... there is a lot of tools to make graphs ... but the important thing to prepare the data in format to be ready to be plotted
ftpphptest1Author Commented:
o ic~~~so i need some example to show how to link php with mySQL to show data in chart
Ionut A. TudorPHP ProgrammerCommented:
You can open new question for that, i think this question with that error T_SL has been solved. Thanks
All Courses

From novice to tech pro — start learning today.