Need Php mysql query help

I want to get error if wrong Admission no is entered.
I’m not able to find a way Plz help me.
https://pastebin.com/dSSL7UP1

Thanks in advance.

Then you would do

if($row['adm_no'] == $_POST['search']){
// execute some code
}

You could also do

if(mysqli_num_rows($resultSet) != 0){
//do some code
}

Should i add this at the end?

After the fetching command :slight_smile:

@ckhawand I’m not able to figure it out can you fix and paste it for me here

<?php
include_once("bg.php");
ob_start();
session_start();
 
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
    //Connect to dataBase
    $mysqli=mysqli_connect("localhost","root","","test");
   
        $search = $mysqli->real_escape_string($_POST['search']);
   
    //query the Database
    $resultSet = $mysqli->query("SELECT * FROM stud_adm WHERE adm_no = '$search'");
   
    $row= mysqli_fetch_array($resultSet);
if(mysqli_num_rows($resultSet) != 0){
//do some code
}
}
?>
1 Like

@ckhawand Gotcha issue fixed.
Thank you so much.

1 Like