Need Php mysql query help


#1

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.


#2

Then you would do

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

#3

You could also do

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

#4

Should i add this at the end?


#5

After the fetching command :slight_smile:


#6

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


#7
<?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
}
}
?>

#8

@ckhawand Gotcha issue fixed.
Thank you so much.


#9