Organizational Research By

Surprising Reserch Topic

check if row exists with mysqli


check if row exists with mysqli  using -'php,mysqli'

I need help checking if a row exists. I am getting "email no longer exists publisher@example.com".

Is there a better way to check if row exists with mysqli?

if (count($_POST)) {
    $email = $dbl->real_escape_string(trim(strip_tags($_POST['email'])));
    $passwd = $dbl->real_escape_string(trim(strip_tags($_POST['passwd'])));

    $query = "SELECT `email` FROM `tblUser` WHERE `email` = '$email'";
    $result = mysqli_query($dbl,$query);
    if(is_resource($result) && mysqli_num_rows($result) == 1 ){
            $row = mysqli_fetch_assoc($result);
            echo $email . " email exists " .  $row["email"] . "\n";
    }
    else{
            echo "email no longer exists" . $email . "\n";
    }   
}

    
asked Oct 11, 2015 by mcasudhir
0 votes
1 view



Related Hot Questions



Government Jobs Opening


...