[Solved] Parse error: syntax error, unexpected T_IF on line 4 [closed]


You’re missing a semi-colon at the end of your include statement.

Change:

include('connect.php') 

To:

include('connect.php');

The reason you’re seeing the if as a cause for the error, is because what you have done. Is missed out the vital point of PHP, Which tells the interpreter to stop processing the current command (hence the semi-colon). So, PHP is still expecting to process the include, so is completely confused when it comes to the following line. Thus throwing an error on what can be seen as the wrong line.

3

solved Parse error: syntax error, unexpected T_IF on line 4 [closed]