ok so im trying to make a guest book type thing
and here is the code
<html>
<head>
<title>The Internet Joke Database</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php if (isset($_GET['addcomment'])): // User wants to add a comment
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="name" value="name">
<label>Type your comment here:<br />
<textarea name="coment" rows="10" cols="40">
</textarea></label><br />
<input type="submit" value="SUBMIT" />
</form>
<?php else: // Default page display
// Connect to the database server
$dbcnx = @mysql_connect('localhost', '********', '********');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the database
if (!@mysql_select_db('eimblog_111mb_com_db')) {
exit('<p>Unable to locate the ' .
'database at this time.</p>');
}
// If a comment has been submitted,
// add it to the database.
if (isset($_POST['coment'])) {
$coment = $_POST['coment'];
$name = $_POST['name'];
$sql = "INSERT INTO about SET
coment='$coment',
name='$name',
postdate=CURDATE()";
if (@mysql_query($sql)) {
echo '<p>Your comment has been added.</p>';
} else {
echo '<p>Error adding submitted comment: ' .
mysql_error() . '</p>';
}
}
echo '<p>Here are all the comments in our database:</p>';
// Request the text of all the comments
$result = @mysql_query('SELECT coment FROM about');
if (!$result) {
exit('<p>Error performing query: ' .
mysql_error() . '</p>');
}
$name = @mysql_query('SELECT name FROM about');
if (!$name) {
exit('<p>Error performing query: ' .
mysql_error() . '</p>');
}
// Display the text of each comment in a paragraph
While(
$row = mysql_fetch_array($result);
$row2 = mysql_fetch_array($name);){
print("<b> .$row2['name'] $row['coment'] . </b>");
}
// When clicked, this link will load this page
// with the joke submission form displayed.
echo '<p><a href="' . $_SERVER['PHP_SELF'] .
'?addcomment=1">Add your comment</a></p>';
endif;
?>
</body>
</html>
'
and i keep getting this error mesage
Parse error: parse error, unexpected ';' in /home/vhosts_111mb/eimblog.111mb.com/about_coment.php on line 70
can someone tell me what im doing wrong






chrishirst posted this at 20:27 — 26th May 2005.
He has: 379 posts
Joined: Apr 2005
and line 70 would be ?
baldrick posted this at 20:50 — 26th May 2005.
He has: 388 posts
Joined: Apr 2005
// Display the text of each comment in a paragraphWhile(
$row = mysql_fetch_array($result);
$row2 = mysql_fetch_array($name);){
print("<b> .$row2['name'] $row['coment'] . </b>");
}
'
harmor posted this at 00:50 — 30th May 2005.
They have: 3 posts
Joined: May 2005
Try Changing
<?phpprint("<b> .$row2['name'] $row['coment'] . </b>\");
?>
To
<?phpprint('<b> .$row2['name'] $row['coment'] . </b>');
?>
Notice the single quotes
baldrick posted this at 19:12 — 30th May 2005.
He has: 388 posts
Joined: Apr 2005
Thaks that woked great
harmor posted this at 23:12 — 30th May 2005.
They have: 3 posts
Joined: May 2005
Glad you got it working
Fluffi posted this at 09:32 — 2nd June 2005.
He has: 38 posts
Joined: Sep 2004
If I remember rightly, this is because php mrely repeats anything contained within double quotes, where as items within single quotes are interpreted. Something like that anyway!
RF
My site | Where I like to pick up chicks at the weekend