Jump to content

[SOLVED] Parse error: parse error, unexpected T_ECHO -- PLEASE HELP


draftermath

Recommended Posts

i am stuck on this,

 

Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in C:\wamp\www\s2007\view_a.php on line 21

<?php

 

include 'config.php';

include 'opendb.php';

 

$header = $_GET['header'];

$url = $_GET['url'];

$description = $_GET['description'];

 

$results = mysql_query("SELECT * FROM articles") or die(mysql_error());

 

// keeps getting the next row until there are no more to get

while($row = mysql_fetch_array( $results )) {

// Print out the contents of each row into a table

echo "<table width=\"90%\" border=\"0\" bgcolor=\"#0000CC\">";

echo "<tr><td bgcolor=\"#006699\"><div align=\"center\">";

echo '<a href="'.$row["url"].'">';

echo $row['header'];

echo "</a></div></td></tr>";

echo "<tr><td bgcolor="#CCCCCC"><div align=\"center\">";

echo $row['description'];

echo "</div></td></tr>";

}

echo "</table>";

 

include 'closedb.php';

?>

 

 

line 21 is

echo $row['description'];

 

but everything looks good to me

You didn't escape all the quotes in this line:

<?php
echo "<tr><td bgcolor="#CCCCCC"><div align=\"center\">";
?>

Write it either as

<?php
echo "<tr><td bgcolor=\"#CCCCCC\"><div align=\"center\">";
?>

or

<?php
echo '<tr><td bgcolor="#CCCCCC"><div align="center">';
?>

 

I prefer the latter way, since you don't have to worry about escaping the double quotes.

 

Ken

Archived

This topic is now archived and is closed to further replies.

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