Parse error: syntax error, unexpected T_IF in......
Posted: Thu Nov 08, 2007 3:07 pm
feyd | Please use
now the first if statement works on the index part of the list becasue it has the php around it, but i need to know how to put this into the echo tag. cheers
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am having trouble with this error, i don't know how to fix it. here is the full error:
Parse error: syntax error, unexpected T_IF in /home/wesley/public_html/forums/header.php on line 15
I am quite new to php so i dunno if this is correct. Help would be much apreciated.
here is the code from the begining:Code: Select all
<?php
require("config.php");
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
function curPageName()
{
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
?>
<ul class='leveltab'>
<li><a href='index.php'<?php if(curPageName('index.php')){echo "class='current'";}?>>Main Page</a></li>
<?php
if(isset($_SESSION['USERNAME']) == TRUE)
{
echo "<li><a href='logout.php'".if(curPageName('logout.php')){echo "class='current'";}.">Logout</a></li>";
}
else{
echo "<li><a href='login.php'>Login</a></li>";
echo "<li><a href='register.php'>Register</a></li>";
}
?>
<li><a href="newtopic.php">New Topic</a></li>
</ul>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]