• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Parse error...I don't see one.

R4g1ng

New Member
Error: Unexpected $ in line 122
PHP:
<?php
include("toppart.php");
include("blog/admin/blog_dbinfo.php");

$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Cannot
connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Cannot select database.");

$id = strip_tags($_GET["id"]);

$q1 = "SELECT * from blog where id='$id' order by date desc ";
$result= mysql_query($q1) or die
("Could not execute query : $q1." . mysql_error());

$row=mysql_fetch_array($result);
$id=$row["id"];
$mood=$row["mood"];
$music=$row["music"];
$entry=$row["entry"];
$date=$row["date"];
$quoteblock = "<table width=\"95%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"><tr><td class=\"quotehead\">quote</td></tr><tr><td class=\"quote\">$1</td></tr></table>";
$entry = str_replace("<", "&lt;", $entry);
$entry = str_replace(">", "&gt;", $entry);
$entry = eregi_replace("\[b\]([^\\[]*)\[/b\]", "<b>\\1</b>", $entry);
$entry = eregi_replace("\[i\]([^\\[]*)\[/i\]", "<i>\\1</i>", $entry);
$entry = eregi_replace("\[u\]([^\\[]*)\[/u\]", "<u>\\1</u>", $entry);
$entry = preg_replace("/\[quote\](.+?)\[\/quote\]/is","$quoteblock", $entry);
$entry = preg_replace("(\[url\=(.+?)\](.+?)\[/url\])", "<a href=\"$1\" target=\"_blank\">$2</a>", $entry);
?>
<div class="div"><?= gmdate("l, j F Y", $date); ?></div>
<strong>Music:</strong> <?= "$music"; ?>
<br />
<strong>Feeling:</strong> <?= "$mood"; ?>
<div class="entry"><?= nl2br($entry); ?></div>
<br />
<br />
<div class="div">Comments</div>
<?php
$q = "SELECT * from blog_comments where blog_id='$id' order by date desc ";
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());

while ($row=mysql_fetch_array($result))
{
$name=$row["name"];
$email=$row["email"];
$site=$row["site"];
$entry=$row["entry"];
$date=$row["date"];
$entry = str_replace("<", "&lt;", $entry);
$entry = str_replace(">", "&gt;", $entry);
if (empty($site) || $site == "http://") {
$who = "$name";
}

else {
$who = "<a href=\"$site\" target=\"_blank\">$name</a>";
}
?>
<div class="entry">
<?php echo "$entry"; ?>
<p>Posted by <?= "$who"; ?> on <?= gmdate("j F Y", $date); ?>.</p>
<?php
}

if ($action=="add")
{
$blog_id = $_GET['id'];
$name = strip_tags($_POST["5145"]);
$entry = strip_tags($_POST["entry"]);
$email = strip_tags($_POST["54193"]);
$site = strip_tags($_POST["5521925"]);
$ip = strip_tags($_SERVER["REMOTE_ADDR"]);

if (empty($name) || empty($entry) || empty($email))
{
die ("Please fill out the required fields");
}

if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\{.[a-z]2,3

})?)$', $email)) {
die ("Please fill in a valid email address");
}

$q = "insert into blog_comments (id, name, email, site, date, blog_id,
entry, ip) VALUES
('','$name','$email','$site',UNIX_TIMESTAMP(),'$blog_id','$entry','$ip')";
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
echo "<meta http-equiv='refresh'
content='0;url=comments.php?id=$blog_id'>";
?>
<br />
<br />
<div class="div">Add a Comment</div>
<form action="comments.php?action=add&id=<?= "$blog_id"; ?>" method="post" />
<table border="0" cellspacing="1" cellpadding="0">
<tr>
<td>Name:*</td>
<td>
<input type="text" name="5145" size="30" />
</td>
</tr>
<tr>
<td height="25">Email*:</td>
<td height="25">
<input type="text" name="54193" size="30" /> (Will not be Displayed)
</td>
</tr>
<td height="25">Website:</td>
<td height="25">
<input type="text" name="5521925" size="30" value="http://" />
</td>
</tr>
<tr>
<td height="25">Comments:*</td>
<td height="25">
<textarea name="entry" cols="30" rows="5"></textarea>
<input type="submit" value="submit" />
</form>
<?php include("bottompart.php"); ?>
I know it's a bit messy but that's not what I'm worried about. I've looked through it so many times but I still can't find what's wrong. Can anyone help and point it out?
Thanks everyone ^^
 
I suggest rewrite everything properly, use indentions and use plain PHP atleast for now ie: not embedding PHP within HTML cause that would be very confusing.
 
<form action="comments.php?action=add&id=<?= "$blog_id"; ?>" method="post" />

That line near the bottom, try taking out the "" around the $blog_id
 
Just a suggestion,
<form action="comments.php?action=add&id=<?= "$blog_id"; ?>" method="post" />
"$blog_id" can you make it into '$blog_id' ?
just a suggestion though hopefully is working if CAWunited solution not working :)
But if CAWUnited solution is working then great :)
 
Back
Top