Forum Moderators: coopster

Message Too Old, No Replies

why am I getting a parse error?

script check

         

electricocean

11:39 pm on Oct 4, 2004 (gmt 0)

10+ Year Member



i made this guestbook code and I tried it but it said:
'Parse error: parse error in /home/www/guestbook/addentry.php on line 83'

Here is line 83:

fwrite ($fp, "<table border='1' cellpadding='0' cellspacing='0' bgcolor='990000' width='250'><tr><td bgcolor='666666'><table border='0' cellpadding='4' cellspacing='0' width='250' cellspacing='0'><tr><td><table width='250'><tr><td colspan='2' align='right'><font face='courier' size='1' color='#FFFFFF'> $name [<a href="mailto:$email">$email</a>] [<A href="$url" target='_NEW'>$url</a>] </td></tr><tr><td width='20'><font face='courier' size='1' color='#FFFFFF'></td><td width='250'><font face='courier' size='1' color='#FFFFFF">$comments</td></tr>
<tr><td width='20'></td>
<td><font face='courier' size='1' color='#FFFFFF'><i>(date( 'l, F, jS Y - g:i:s A' ))</i></td></tr></table></td></tr></table></td></tr></table><br>"); // Write the data. Use \r\n on Windows.
flock ($fp, LOCK_UN);
fclose ($fp); // Close the file.

[edited by: coopster at 1:17 am (utc) on Oct. 5, 2004]
[edit reason] edited code dump [/edit]

Adrian2k4

11:53 pm on Oct 4, 2004 (gmt 0)

10+ Year Member



Escape the quotes within the string.
Try ZEND Studio for debugging. (www.zend.com)
There is a 30 day trail free to download.

Line 82:

fwrite ($fp, "<table border='1' cellpadding='0' cellspacing='0' bgcolor='990000' width='250'><tr><td bgcolor='666666'><table border='0' cellpadding='4' cellspacing='0' width='250' cellspacing='0'><tr><td><table width='250'><tr><td colspan='2' align='right'><font face='courier' size='1' color='#FFFFFF'> $name [<a href=\"mailto:$email\">$email</a>] [<A href=\"$url\" target='_NEW'>$url</a>] </td></tr><tr><td width='20'><font face='courier' size='1' color='#FFFFFF'></td><td width='250'><font face='courier' size='1' color='#FFFFFF'>$comments</td></tr>
<tr><td width='20'></td>
<td><font face='courier' size='1' color='#FFFFFF'><i>(date( 'l, F, jS Y - g:i:s A' ))</i></td></tr></table></td></tr></table></td></tr></table><br>"); // Write the data. Use \r\n on Windows.

[edited by: Adrian2k4 at 12:35 am (utc) on Oct. 5, 2004]

encyclo

11:57 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



color='#FFFFFF[b]"[/b]>$comments

Double-quote mark should be a single-quote mark: '#FFFFFF'. A few other unescaped quotes in there, too.

What editor are you using? Does it have text highlighting? All I did was paste the script into my editor, look at line 83 and see where the highlighting went wrong.

electricocean

2:42 am on Oct 6, 2004 (gmt 0)

10+ Year Member



I use SimpleText on mac.

mincklerstraat

7:38 am on Oct 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jedit does great highlighting and is probably macable. Highlights beginning/ending quotes-brackets-parentheses too when you put your cursor on 'em.

Adrian2k4

1:31 am on Oct 7, 2004 (gmt 0)

10+ Year Member



There is a very good universal IDE (integrated development environment) called Eclipse. (www.eclipse.org)
Its open source and there for free and there is a version of Eclipse that runns on MacOS.

electricocean

1:30 am on Oct 10, 2004 (gmt 0)

10+ Year Member



i have mac os 9