rocket01 Posted October 7, 2009 Share Posted October 7, 2009 Guys I have recently been creating a login page for my website, and i'm not exactly an expert at this. I have been having an error showing during testing of the code and i was wondering could anyone point me in the right direction. The error is: Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\login.php on line 17 The Code is: <?php $username = $_POST['username']; $password = $_POST['password']; if ($username&&$password) { $connect = mysql_connect("localhost","root","") or die ("failed"); mysql_select_db("phplogin") or die ("failed"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query) if ($numrows!=0) { while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } // check to see if they match! if ($dbusername==$dbusername&&dbpassword==dbpassword) { echo "you're in"; } else echo "incorrect password!"; } else die ("No!"); } else die ("Please Enter a Username and Password"); ?> Any help would be much appreciated. PS the line 17 that is showing the error is highlighted in blue Link to comment https://forums.phpfreaks.com/topic/176775-solved-php-login-code-errors/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 7, 2009 Share Posted October 7, 2009 There is a missing ; on the line before the line where the error is reported because php cannot determine what the programmer intended when he left off the ; Link to comment https://forums.phpfreaks.com/topic/176775-solved-php-login-code-errors/#findComment-932059 Share on other sites More sharing options...
rocket01 Posted October 7, 2009 Author Share Posted October 7, 2009 fantastic! I knew it was something simple just couldn't for the life of me spot it! Link to comment https://forums.phpfreaks.com/topic/176775-solved-php-login-code-errors/#findComment-932063 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.