this is my sign up script…
[code=php]
<?php
$fname = $_POST[‘fname’];
$lname = $_POST[‘lname’];
$gender = $_POST[‘gender’];
$email = $_POST[’email’];
$password1 = $_POST[‘pass1’];
$password2 = $_POST[‘pass2’];
if($password1 != $password2)
header(‘Location: signup.html’);
$passwordHash = sha1($_POST[‘pass1’]);
$mysqli = new mysqli(‘localhost’, ‘root’, ‘dhiraj’, ‘test’); //we change the mysqli_connect to “new mysqli”
$query = “INSERT INTO users ( u_fname, u_lname, gender,u_email, u_pass) VALUES
( ‘$fname’, ‘$lname’, ‘$gender’ , ‘$email’, ‘$passwordHash’ )”;
//remove $conn variable in order to connect to our database using OOP.
$mysqli->query($query);
$mysqli->close();
header(‘Location: index.html’);
?>
and this is login script
[code=php]
<?php
$email = $_POST[‘log_email’];
$passwordHash = sha1($_POST[‘log_pass’]);
$conn = mysqli_connect(‘localhost’, ‘root’, ‘dhiraj’, ‘test’);
$query = “SELECT u_fname
FROM users
WHERE u_email = ‘$email’ AND u_pass=’$passwordHash’;”;
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) < 1)
{
echo ‘Sorry, your username or password was incorrect!’;
// this echo statement gets executed. what is the problem?
}
else
{
/* Log user in */
echo “Welcome back $_POST[‘log_email’] “;
}
?>
So everything works …has is calculated on password…database gets updated bu the problem is after login
the echo statement gets executed ..means no result generated from the query in the login script.
pls help me.
would love if provide any script. Thanks