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
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.