I need to show all the results in the database when the user types a word which includes in the original data in the table.
As an instance, there is a tuple in the database which has a value of "Alabaster25_24x18".
so when the user types "Ala" or "Alab" or "Alabas" this tuple should retrieve and other tuples which contain Alabaster keyword should retrieve.
I have written a code chunk for that.
<form action="" method="POST">
Board Code: <input name="job_no" type="text" /> </br>
Material Description : <input name="client_ref" type="text" /></br>
Thickness: <input name="thickness" type="text" /></br>
<button type="submit" name="submit">Submit</button>
</form>
<?php
if(isset($_POST["submit"])){
$servername="localhost";
$username = "root";
$password = "";
$dbname = "db";
$conn = new mysqli($servername,$username,$password,$dbname);
if(!$conn){
die('Not connected : ' . mysql_error());
}
if (!function_exists('bind_array')) {
function bind_array($stmt, &$row) {
$md = $stmt->result_metadata();
$params = array();
while($field = $md->fetch_field()) {
$params[] = &$row[$field->name];
}
call_user_func_array(array($stmt, 'bind_result'), $params);
}
}
$job_no = $_POST["job_no"];
$client_ref = $_POST["client_ref"];
$thickness= $_POST["thickness"];
if(empty($job_no) ){
echo "Input at least one data";
}else if(empty($client_ref)){
$Query = Database::Prepare("SELECT * FROM new_jobs WHERE thickness LIKE ?");
$Query->Execute(array("%".$job_no."%"));
while($query->fetch()){
echo "The Promised Date is ".$row[$Query];
}
}else{
// echo "koihgygyugui";
}
}
?>
Unfortunately, it is not getting the intended results.
Any suggestions?