Jump to content

[SOLVED] Don't understand this error:


LiamProductions

Recommended Posts

Hey,

 

I've got an error in my login script i don't quite understand it:

 

<?php

if(!isset($_POST['Login'])) {
if(!isset($_POST['user'])) {
	if(!isset($_POST['pass'])) {
		$user = $_POST['user'];
		$pass = $_POST['pass'];
		$user = strip_tags($user);
		$pass = strip_tags($pass);

		mysql_connect('localhost', 'liam_liam', 'code090');
		mysql_select_db('liam_database');

		$checkUser = mysql_query('SELECT * FROM user WHERE username ="'.$user.'" AND password ="'.md5.$pass.'"');
		$checkUserRows = mysql_num_rows($checkUser);

		if($checkUserRows > 0) {
			$_SESSION['user'] = $user;
			echo 'Session is set';
		}
		else {
			echo "Your cannot login because your data is not on my database";
		}

	}
	else {
		echo "Please enter a password to login";
	}
}
else {
	echo "Please enter a username to login";
}
}
else {
echo "You did not fill in all login form";
}


?>

 

Theres a error saying something about a error on mysql_num_rows and

its saying You cannot login because your data is not in my database... but the data is...

 

help please.

Link to comment
https://forums.phpfreaks.com/topic/65068-solved-dont-understand-this-error/
Share on other sites

i ran into a problem on my login page also that gave me the same error that user was not in database. i had to change the length of my password to atleast 32 due to the scrambling of it in the database. once i did that the user after entering or registering them again was found.

 

hope that helps

Try this:

 

$checkUser = mysql_query('SELECT * FROM user WHERE username ="'.$user.'" AND password ="'.md5($pass).'"')or die(mysql_error());

 

Thank you very much, It would of been lots easier if i spotted it my self...

 

The table was User not user lol but thanks i found the error thanks to that mysql_error

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.