Jump to content

error : unknown column in where clause


valdes

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/296046-error-unknown-column-in-where-clause/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.