soc86 Posted September 12, 2011 Share Posted September 12, 2011 I keep getting an error code when running my php, it states: Parse error: syntax error, unexpected $end in W:\www\blog\login.php on line 33 Line 33 is </html> <?php mysql_connect ("localhost", "root", ""); mysql_select_db("blog"); ?> <html> <head> <title>Login</title> </head> <body> <?php if(isset($_POST['submit'])){ $name = $_POST['name']; $pass = $_POST['password']; $result = mysql_query("SELECT * FROM users WHERE name='$name' AND pass='$pass'"); $num = mysql_num_rows($result); if($num == 0){ echo "Bad login, go <a href='login.php'>back</a>"; }else{ session_start(); $SESSION ['name'] = $name; header("Location: admin.php"); } ?> <form action='login.php' method='post'> Username: <input type='text' name='name' /><br /> Password: <input type='password' name='password' /><br /> <input type='submit' name='sumbit' value='Login!' /> </form> </body> </html> Can any one advise me whats wrong? Quote Link to comment https://forums.phpfreaks.com/topic/246992-parse-error-syntax-error-unexpected-end-in-wwwwblogloginphp-on-line-33/ Share on other sites More sharing options...
premiso Posted September 12, 2011 Share Posted September 12, 2011 You never close this if statement: if(isset($_POST['submit'])){ Quote Link to comment https://forums.phpfreaks.com/topic/246992-parse-error-syntax-error-unexpected-end-in-wwwwblogloginphp-on-line-33/#findComment-1268483 Share on other sites More sharing options...
soc86 Posted September 12, 2011 Author Share Posted September 12, 2011 Thank you!!! P.S. This is the best PHP forum on the web! Quote Link to comment https://forums.phpfreaks.com/topic/246992-parse-error-syntax-error-unexpected-end-in-wwwwblogloginphp-on-line-33/#findComment-1268492 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.