Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As others have pointed out, you are mixing <code>if() { ... }</code> and <code>if(): endif;</code>, which is confusing things. There's no actual difference between the two, but they have to match up in pairs - you can't write <code>if ( test_something() ) { do_something(); endif;</code> This is documented in the manual under <a href="http://php.net/manual/en/control-structures.alternative-syntax.php" rel="nofollow">Alternative syntax for control structures</a>:</p> <blockquote> <p>Note: Mixing syntaxes in the same control block is not supported. </p> </blockquote> <p>The other thing to note is that each PHP file included must have valid syntax on its own - PHP doesn't stick all the code together and then parse it - so you can't open an <code>if</code> statement in one file and then close it in another. (I can't actually find a good manual reference for this; if someone knows one, let me know in the comments, or edit it in here.)</p> <p>If you always indent further when you open an <code>if</code> statement or similar block, the structure of code generally becomes much clearer. If we do this to your code, and strip out everything else, we are left with this; see the comments I've added for where it's going wrong:</p> <pre><code>// header.php if ($page == 'profile'): if(isset($_GET['username']) &amp;&amp; empty($_GET['username']) === false) { if ($users-&gt;user_exists($username) === false) { }else{ } // Closing with endif, but opened with { endif; // unclosed if statement at end of file // footer.php: if ($page == 'profile'): // closing with } but opened with : }else{ } // stray endif, presumably intended to match the if: at the top of header.php endif; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload