简体   繁体   中英

PHP Error Message is not getting displayed

So i was doing a login form its not logging in and also not displaying the error. The Code Is Following Below:

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "studentlogin";
$conn = new mysqli($servername,$username,$password,$dbname);
if($conn->connect_error){
    echo "Connection Failed..//".$conn->connect_error;
}
else{
echo "<br>Connection Established..//";
$loginid = $_POST['id'];
$loginpass = $_POST['loginpass'];
$sql2 = "SELECT LOGINID,PASS FROM EMAIL WHERE LOGINID = '".$loginid."' AND PASS = '".$loginpass."'";
//$sql = "SELECT EMAIL FROM EMAIL WHERE ID = '".$loginid."'";
$result = $conn->query($sql2);
if($result===TRUE){
    $result = $conn->query($sql2);
    if($result->num_rows>0){
        while($row=$result->fetch_assoc()){
            echo "<br>".$row['LOGINID']." welcome to the Student Dashboard..//";
        }
    }
}
else
{
    echo "<br>The Following Error Occured..//";
    echo $conn->error;
}
}
$conn->close();
?>

And Following is the output:

Connection Established..//
The Following Error Occured..//

Please do help I have been stuck on this for like 2 days.

Using mysqli->query() with a SELECT statement returns an instance of mysqli_result. It is not identical to true (=== true), but nor does it represent an error.

please watch the link: https://stackoverflow.com/a/34228258/2812447

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM