dudejma Posted July 14, 2010 Share Posted July 14, 2010 I get this error: Parse error: syntax error, unexpected '}' in /home/virtu857/public_html/aandwtechsupport.co.cc/login_process.php on line 36 This is my code: <?php session_start(); include('connections/systems.php'); // Username and the password from form, and protected from MySQL injection $email = mysql_real_escape_string(stripslashes($_POST['email'])); $password = mysql_real_escape_string(stripslashes($_POST['password'])); $result = mysql_query("SELECT * FROM users WHERE email='$email' and password='$password'"); if(mysql_num_rows($result) == 1) // If query returned 1 row{ // Register nessecary sessions. session_register("email"); // It would be wise to do $_SESSION['email'] = $email; session_register("password"); if ($level == "1") { header("location: client.php"); } else if ($level == "2") { header("location: staff.php"); } else if ($level == "3") { header("location: techadmin.php"); } else if ($level == "4") { header("location: admin.php"); } else { header("location: login.php"); } } ?> Line 36: } Thanks for any help! Quote Link to comment Share on other sites More sharing options...
hcdarkmage Posted July 14, 2010 Share Posted July 14, 2010 Your missing a beginning {: if(mysql_num_rows($result) == 1) { //<--- Here Quote Link to comment Share on other sites More sharing options...
radar Posted July 14, 2010 Share Posted July 14, 2010 if(mysql_num_rows($result) == 1) no { after that.. try it and see if it works hcdarkmage beat me to it ;( Quote Link to comment Share on other sites More sharing options...
dudejma Posted July 14, 2010 Author Share Posted July 14, 2010 Thanks. Now there is a new error. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/virtu857/public_html/aandwtechsupport.co.cc/login_process.php on line 10 Line 10: if(mysql_num_rows($result) == 1){ Quote Link to comment Share on other sites More sharing options...
dudejma Posted July 15, 2010 Author Share Posted July 15, 2010 ??? Any help, please! Quote Link to comment Share on other sites More sharing options...
trq Posted July 15, 2010 Share Posted July 15, 2010 That means your query is failing. Considering 'password' is a mysql function you will likely need to change the name of that field to something else. or escape it using `backticks`. Quote Link to comment Share on other sites More sharing options...
radar Posted July 15, 2010 Share Posted July 15, 2010 or you can do what i do is change your query line into 2 lines... $sql = "SELECT * FROM users WHERE email='".$email."' AND password='".$password."'"; $result = mysql_query($sql); but then commenting out the $result (or not even) and adding in: echo $sql; to verify that the query itself has the wanted information. Quote Link to comment 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.