Jump to content

login


ecabrera

Recommended Posts

can anyone explain what im doing wrong i get

Warning: mysql_num_rows() expects parameter 1

Warning: mysql_fetch_assoc() expects parameter 1

<?php

//decaling the error message
$msg = "";

//checing if the submit button has been pressed
if(isset($_POST['loginbtn'])){

//creating a connection
include "db_con.php";

//getting the values of the user's email and password
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);

//password into md5
$password =  md5($password);

//cheing to see if the enterd a email or password
if($email){
	//cheing to see if the enterd a email or password
	if($password){

	//getting the user data
	$query = mysql_query("SELECT * FROM users WHERE email=$email");
	$numrows = mysql_num_rows($query);

	//checking to see if user input email matches db email
	if($numrows == 1){

	$get = mysql_fetch_assoc($query);

	$dbemail = $get['email'];
	$dbpassword = $get['password'];

	if($dbemail == $email){
		if($dbpassword == $password){

		$email = $_SESSION['email'];
		header('Location: homepage.php');

		}else
			$msg = "Please check your password";
	}else
		$msg = "Please check your email";
	}else
		$msg = "No person with that email";
	}else
		$msg = "No password enter";
}else
	$msg = "No email enter";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/265630-login/
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.