Syntax Error


if (isset(($user_info['uid']) = $c_row['adminid']) && ($u_row ['accounttype'])== 1)
{
     mysql_query("UPDATE `companies` SET `eviews` = `eviews` + 1 WHERE `adminid` = '${user_info['uid']}'");
}

Error: Parse error: syntax error, unexpected T_STRING, expecting ‘(’ on line 22

Those are great.

I’ve had loads of those, I didn’t post them here though; that would be silly.

I eventually figured out how to address them myself. Sometimes though, I politely asked for help after detailing what my desired outcome was.

Whoops… this was the error I meant to display…

Parse error: syntax error, unexpected ‘(’

there’s something wrong with your sql

From da manual

isset() only works with variables as passing anything else will result in a parse error.

I removed the isset


if ((($user_info['uid']) = $c_row['adminid']) && ($u_row ['accounttype'] = 1))
		{
			mysql_query("UPDATE `companies` SET `eviews` = `eviews` + 1 WHERE `adminid` = '${user_info['uid']}'");
		}

Still getting this error: Parse error: syntax error, unexpected ‘=’

You have too many parentheses in your code.

Try this:


if($user_info['uid']) == $c_row['adminid'] && $u_row ['accounttype'] == 1)
        {
            mysql_query("UPDATE `companies` SET `eviews` = `eviews` + 1 WHERE `adminid` = '${user_info['uid']}'");
        } 

Also, if you want to compare values, use ==
To make sure the values are completely identical, you can use ===
A single = is an assignment, and will always return true - so in your code above, you were trying to set $user_info[‘uid’] to have the same value as $c_row[‘adminid’]

Let us know if that’s cleared it up for you! :slight_smile: