Parse error: syntax error, unexpected T_IF

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
liamf91
Forum Newbie
Posts: 3
Joined: Thu Jul 19, 2007 4:38 pm

Parse error: syntax error, unexpected T_IF

Post by liamf91 »

Hi im currently working with phpbb and i came across this error Parse error: syntax error, unexpected T_IF

this is the piece of code:

Code: Select all

if( !($result2 = $db->sql_query($sql)))
		message_die(GENERAL_ERROR, 'Could not obtain users PM information', '', __LINE__, __FILE__, $sql);
	}
	$to_users = $db->sql_fetchrowset($result2);
	$n=0;
	while ($to_username_array[$n] && !$error)
	{
		if (strcasecmp($to_users[$n]['username'], str_replace("\'", "'",$to_username_array[$n]))) 
		{ 
			$error = TRUE; 
			$error_msg .= $lang['No_such_user']." '".str_replace("\'", "'", $to_username_array[$n]);
		}
		$n++;
	}
}
else
{
thanks
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Your missing an opening brace after if( !($result2 = $db->sql_query($sql))).
liamf91
Forum Newbie
Posts: 3
Joined: Thu Jul 19, 2007 4:38 pm

Post by liamf91 »

i tried it like this

Code: Select all

if( !($result2 = $db->sql_query($sql))) {
but it didnt work.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

if(!$result2 = $db->sql_query($sql)) {
no need for extra brackets anyways.. however you still do have an extra closing curly brace in your snipplet
liamf91
Forum Newbie
Posts: 3
Joined: Thu Jul 19, 2007 4:38 pm

Post by liamf91 »

ive found the problem i missed a ; on a line above it. thanks anyway
Post Reply