Forum Moderators: coopster

Message Too Old, No Replies

Need help with a php error

         

johnd06

4:59 pm on Jul 21, 2008 (gmt 0)

10+ Year Member



Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home1/loftnite/public_html/view.php on line 85

line 85:
echo "<table><tr><td><strong><a href="view.php?action=view&id=$ID">$title</a></strong></td></tr>

StoutFiles

5:01 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Corrected:

echo '<table><tr><td><strong><a href="view.php?action=view&id='.$ID.'">'.$title.'</a></strong></td></tr>';

johnd06

5:04 pm on Jul 21, 2008 (gmt 0)

10+ Year Member



ok but the entire code is

echo "<table><tr><td><strong><a href="view.php?action=view&id=$ID">$title</a></strong></td></tr>
<tr><td><small>Written by $author on $date</small></td></tr>
<tr><td>$content</td></tr>";

StoutFiles

5:09 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Corrected:

echo '<table><tr><td><strong><a href="view.php?action=view&id='.$ID.'">'.$title.'</a></strong></td></tr>
<tr><td><small>Written by '.$author.' on '.$date.'</small></td></tr>
<tr><td>'.$content.'</td></tr>';

If you echo with content in "" quotes, you can't use " for your a href or it thinks that's the end of the echo. It's reading echo "<table><tr><td><strong><a href=" and then stopping. Use single quotes for the echo or put a \ in front of any " you are echoing.

[edited by: StoutFiles at 5:10 pm (utc) on July 21, 2008]

johnd06

5:20 pm on Jul 21, 2008 (gmt 0)

10+ Year Member



thank u, it worked :)