Page 1 of 1

Parse error: syntax error, unexpected T_IF

Posted: Thu Jul 19, 2007 4:42 pm
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

Posted: Thu Jul 19, 2007 4:49 pm
by Benjamin
Your missing an opening brace after if( !($result2 = $db->sql_query($sql))).

Posted: Thu Jul 19, 2007 5:14 pm
by liamf91
i tried it like this

Code: Select all

if( !($result2 = $db->sql_query($sql))) {
but it didnt work.

Posted: Thu Jul 19, 2007 5:28 pm
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

Posted: Thu Jul 19, 2007 5:33 pm
by liamf91
ive found the problem i missed a ; on a line above it. thanks anyway