1

I got this error:

Parse error: syntax error, unexpected 'if' (T_IF), expecting ',' or ';'.

What's the problem? I couldn't find it, Thanks.

echo '<strong>Role:</strong>'if($query['role'] == 1){echo 'Admin';} elseif ($query['role'] == 2){echo 'User'} '<br>';
Nico Haase
  • 11,420
  • 35
  • 43
  • 69
Can1
  • 89
  • 1
  • 13
  • 1
    After each expression in php you will need to have semicolon. After your ```echo``` statement you don't have semicolon ( ; ). – Ali Farhoudi Mar 31 '16 at 12:28

1 Answers1

2
echo '<strong>Role:</strong>';

if($query['role'] == 1){
    echo 'Admin';
} elseif ($query['role'] == 2){
    echo 'User';
} 

echo '<br>';
Daan
  • 12,099
  • 6
  • 34
  • 51