I have never used the LIKE expression before, so perhaps I am missing something out of my coding.
I want to say, if any of the text matches what's in the status column in the database, output it.
$searchText = $_GET["searchText"];
$sql = "SELECT status FROM tbl_status WHERE status like '% $searchText %'";
$q = $conn->prepare($sql);
$q->bindValue(':who',$who,PDO::PARAM_INT);
$q->execute();
while($r = $q->fetch(PDO::FETCH_ASSOC)){
echo $r['status'];
}
Currently, no result is shown on the page, despite the fact the information is 100% in the database.
Updated code, due to errors. (Still outputting result)
$sql = "SELECT status FROM tbl_status WHERE status like '%:searchText%'";
$q = $conn->prepare($sql);
$q->bindValue(':searchText',$searchText,PDO::PARAM_INT);
$q->execute();
while($r = $q->fetch(PDO::FETCH_ASSOC)){
echo $r['status'];
}