Click here to Skip to main content
15,886,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Any idea? it always say (Password or Email is wrong, try again)
XML
<!--start login form-->

        <form name="userinfo_2" id="form_28" method="post" action="index.php" target="_self" enctype="application/x-www-form-urlencoded" class="OBJ-11" style="position:absolute;left:6px;top:12px;width:236px;height:140px;">
          <input id="edit_1" name="email" class="OBJ-12" maxlength="50" style="position:absolute;left:92px;top:7px;width:134px;height:22px;">
          <input id="edit_2" name="password" class="OBJ-12" maxlength="25" type="password" style="position:absolute;left:92px;top:37px;width:132px;height:22px;">
          <input id="butn_1" name="login" class="OBJ-13" type="submit" value="Login" style="position:absolute;left:147px;top:74px;width:76px;height:22px;">
          <input id="butn_2" name="Reset" class="OBJ-13" type="reset" value="Clear" style="position:absolute;left:144px;top:108px;width:81px;height:22px;">
          <div id="txt_5" style="position:absolute;left:8px;top:38px;width:71px;height:16px;overflow:hidden;">
            <p class="Normal"><span class="C-3">Password:</span></p>
          </div>
          <div id="txt_4" style="position:absolute;left:8px;top:8px;width:73px;height:16px;overflow:hidden;">
            <p class="Normal"><span class="C-3">Email:</span></p>
          </div>
        </form>

<?php

include("includes/db.php");

    if(isset($_POST['login'])){

        $email = mysqli_real_escape_string($con,$_POST['email']);
        $password = mysqli_real_escape_string($con,$_POST['password']);

    $sel_user = "select * from jobseeker where admin_email='$email' AND password='$password'";

    $run_user = mysqli_query($con, $sel_user);

     $check_user = mysqli_num_rows($run_user);

    if($check_user==1){

    $_SESSION['admin_email']=$email;

    echo "<script>window.open('home_user.php?logged_in=You have successfully Logged in!','_self')</script>";

    }
    else {

    echo "<script>alert('Password or Email is wrong, try again!')</script>";

    }
    }

?>
Posted
Updated 9-Aug-15 22:43pm
v4

mysqli_query does not return a record set in all cases...see help page:http://php.net/manual/en/mysqli.query.php[^]
It is obvious in your case that you got somethin else than a result set. You have to debug to see what you got and check the reasons for it...I would look for an error...
 
Share this answer
 
I solve the problem, its my mistake...


PHP
<?php

include("includes/db.php");

    if(isset($_POST['login'])){

        $email = mysqli_real_escape_string($con,$_POST['email']);
        $password = mysqli_real_escape_string($con,$_POST['password']);

    $sel_user = "select * from jobseeker where email='$email' AND password='$password'";

    $run_user = mysqli_query($con, $sel_user);

     $check_user = mysqli_num_rows($run_user);

    if($check_user==1){

    $_SESSION['email']=$email;

    echo "<script>window.open('home_user.php?logged_in=You have successfully Logged in!','_self')</script>";

    }
    else {

    echo "<script>alert('Password or Email is wrong, try again!')</script>";

    }
    }

?>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900