Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP: Can't find syntax error
    text
    copied!<blockquote> <p>Parse error: syntax error, unexpected $end in blah/blah/blah.php line 1</p> </blockquote> <p>This is the error that I receive, with this code</p> <pre><code>&lt;?php include("db.php"); if (isset($_POST['username']) &amp;&amp; isset($_POST['password']) &amp;&amp; isset($_POST['email'])) { //Prevent SQL injections $username = mysql_real_escape_string($_POST['username']); $email = mysql_real_escape_string($_POST['email']); //Get MD5 hash of password $password = md5($_POST['password']); //Check to see if username exists $sql = mysql_query("SELECT username FROM usersystem WHERE username = 'username'"); if (mysql_num_rows($s &gt; 0)) { die ("Username taken."); } mysql_query("INSERT INTO usersystem (username, password, email) VALUES ( '$username', '$password', '$email')") or die (mysql_error()); echo "Account created."; } ?&gt; </code></pre> <p>I've already checked for unclosed brackets, that's not the problem. Also by troubleshooting with it, I've discovered that the include("db.php"); is causing the problem. When I comment it out, It loads the page just fine. However even when db.php is completely blank, just an empty .php file it still gives me the same error. I'm perplexed. Anyone have any ideas?</p> <p>here is my db.php file, but honestly when I make db.php completely blank I get the same error. And I am saving it correctly.</p> <pre><code>&lt;?php session_start(); mysql_connect("localhost", "mydatabase", "mypassword"); mysql_select_db("ratherda_jetpackfandango"); function user_login ($username, $password) { //take the username and prevent SQL injections //$username = mysql_real_escape_string($username); //begin the query $sql = mysql_query("SELECT * FROM user WHERE username = 'username' AND password = 'password' LIMIT 1"); //check to see how many rows were returned $rows = mysql_num_rows($sql); if ($rows&lt;=0 ) { echo "Incorrect username/password"; } else { //have them logged in $_SESSION['username'] = $username; } } ?&gt; </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