Jump to content

[Error] A news viewing script


Notoriouswow

Recommended Posts

Hello everyone, I have a script that shows the news posted on my website in a bigger format with comments ect... but it gives me the error

Parse error: syntax error, unexpected '}' in /home/stormgc/public_html/sources/news_view.php  on line 50

 

I reviewed the code, I know what the error fix would be, but I cannot find the proper place to put it.

 

If someone could please review the script and help that would be awesome!

-->

<?

$id = $_GET['id'];

$news = mysql_query("SELECT * FROM `news` WHERE id='$id'");

if(mysql_num_rows($news) > 0){

$newz = mysql_fetch_array($news);

loadHeader($newz['title']);
}
if($_GET['update'] == 1){

	confirm('You have successfully updated this news.');

}

?>

<br />

<div class="title"><? echo $newz['title']; ?><span class="options"><a href="index.php">Home</a> / <? echo $newz['title']; ?></span></div>

<div class="content">

<?
$username = $newz['username'];

			?>

			<div class="category"><a href="index.php?action=news_view&id=<? echo $newz['id']; ?>"><? echo $newz['title']; ?></a> posted on <? displayTime($newz['time'], 'F jS, Y \a\t g:i a'); ?>

			<span class="options">By 

			<?

			$accounts = mysql_query("SELECT * FROM accounts JOIN profiles ON accounts.username=profiles.username WHERE accounts.username='$username'");

			if(mysql_num_rows($accounts) > 0){

				$account = mysql_fetch_array($accounts);

				?>

				<a href="index.php?action=profile&user=<? echo $account['username']; ?>">{<? } echo $account['display_name']; ?></a>

				<?

			} else {

				echo $username;

			}

			?>

			</span></div>

			<div class="cell1">

			<?

			echo parseText($newz['message']);

			?>

			<br /><br />
			<a href="index.php?action=forums">Discuss this in the forums...</a>

			<?

			if($cur_account['staff'] == "on" || $cur_admin == 1){

				?>

				<br />
				<br />

				<a href="index.php?action=news_modify&id=<? echo $newz['id']; ?>">Modify</a> | <a href="" onClick="if(confirm('Are you sure you want to delete this news?')){ location.href='index.php?action=news_delete&id=<? echo $newz['id']; ?>'; } return false;">Delete</a>

				<?

			}

			?>

</div>

<?

loadFooter();

} else {

fatalError('The news article you are trying to view does not exist.');

}

?>

 

Thanks,

NW

Link to comment
Share on other sites

Normally I don't copy/paste code to find the actual line, its easier when you let it be known which line 50 would be when posting the entire lot of code, but I felt compelled to tonight..

 

Your issue is, Line 46:

		?>

				<a href="index.php?action=profile&user=<? echo $account['username']; ?>">{<? } echo $account['display_name']; ?></a>

				<?

 

In particular, the <? after the link portion. you have a closing bracket within the php right before the "echo" then line 50 is another closing bracket, along with the "else" take the one out before the echo and that should clear things up for you..

 

Fixed (or should be):

		?>

				<a href="index.php?action=profile&user=<? echo $account['username']; ?>">{<? echo $account['display_name']; ?></a>

				<?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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