valdes Posted May 3, 2015 Share Posted May 3, 2015 Ok I been working our on something, again a login page other conditions seem to work except this. It doesn't seem to show errors but when I compile inside wamp, I see this Unknown column in where clause Code goes like this else if($username!=="admin" && $password!=="admin") { //do a connection to database and check for existing user.. $con = mysqli_connect(DBHOST,DBUSER,DBPASS,DB) or die ('Cannot connect'); mysqli_select_db($con,DB); $query = "select * from users where username = $username AND password = $password"; $result = mysqli_query($con,$query); if($result == false) { die('Error :'.mysqli_error($con)); } $rows = mysqli_num_rows($result); if($rows==1) { $_SESSION['login_user'] = $username; header("Location: lecturerarea.php?login=new"); mysqli_close($con); } } Pls what seems to go wrong here? Quote Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted May 3, 2015 Share Posted May 3, 2015 use single quotes around your variables in your where clause Quote Link to comment Share on other sites More sharing options...
valdes Posted May 3, 2015 Author Share Posted May 3, 2015 Thanks I fixed it already. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted May 3, 2015 Share Posted May 3, 2015 Does that mean your problem is solved or do you still have an error? Quote Link to comment Share on other sites More sharing options...
Solution valdes Posted May 4, 2015 Author Solution Share Posted May 4, 2015 It's solved. This main problem is solved thank you 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.