I have a search engine that I found on google and I would like to search in the 'barcode' database that I have and if it finds the person it executes the code that is under $statement (I added that code under $statement that wasn't include in the code that I found), I'm not interested in an echo of the information, that is why I eliminated that part and placed with a refresh, I would only be interested in executing the changes in the sql once it finds the person you are looking for, it does not have to be the code like this below, I really don't know how to do it and I'm here for help.
<?php
include 'includes/conn.php';
include 'includes/scripts.php';
if (isset($_POST['no'])) {
$sca=trim($_POST['no'],"");
$credentials="";
$new2 ="SELECT * FROM `barcode`";
$mysqli = new $conn;
$statement= $mysqli->prepare("Insert IGNORE into voters
Select * from barcode where id = id;
DELETE from barcode where id IN(SELECT id from voters)");
$res2=mysqli_query($conn, $new2);
while($row=mysqli_fetch_array($res2)){
if($row['credentials'] == $sca){
$statement->execute();
header("refresh: .5");
}
}
}
$statement->close();
mysqli_close($conn);
?>