$query = $_POST["name"];
$mob = $_POST["phone"];
is that this query is correct
$sql="SELECT * FROM oath WHERE name='%".$query."%' && phone='%".$mob."%'";
$query = $_POST["name"];
$mob = $_POST["phone"];
is that this query is correct
$sql="SELECT * FROM oath WHERE name='%".$query."%' && phone='%".$mob."%'";
You have at least three issues:
%, use LIKE operator to check whether a specific character string matches a specified pattern&& with AND to combine your boolean expressions (MySQL supports && operator, but other database engines don't)Your statement:
$sql = "SELECT * FROM oath WHERE name LIKE '%".$query."%' AND phone LIKE '%".$mob."%'";
Prepared statement:
<?php
...
# Input
$name  = $_POST["name"];
$phone = $_POST["phone"]; 
$name  = "%$name%";
$phone = "%$phone%"; 
# Statement
$sql = "SELECT * FROM oath WHERE name LIKE :name AND phone LIKE :phone";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':phone', $phone);
# Execution 
$statement->execute();
# Result
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
...
?>
 
    
    The issue is here:
name='%".$query."%' ... phone='%".$mob."%'"
here you are mixing equality comparison ie = with wild card search ie % which is wrong.
Try this:
$sql = "SELECT * FROM oath WHERE name LIKE '%".$query."%' AND phone LIKE '%".$mob."%'";
and also replace && with AND
 
    
    Try This
$sql = "SELECT * FROM oath WHERE name LIKE '%".$query."%' AND phone LIKE '%".$mob."%'";
 
    
    