I want to show my database value when use type first character of the value. Let me describe it with my site I have a website with homepage input where user type input as t
Try this
if (isset($_POST['searchVal'])) {
$searchquery = $_POST['searchVal']; //input for search
//count table to see if any row/column has the train number
$searcher = mysqli_query("SELECT COUNT(*) FROM tablename WHERE trainno LIKE '%$searchquery%'") or die("could not search");
$count = mysqli_num_rows($searcher);
if ($count == 0) {
echo "No results found";
} else {
//while loop to select row with train name
while($row = msqli_fetch_array($query)) {
$trainnname = $row['trainname'];//name of row containing train name
echo $trainname;
}
}
}
Hope you understand how this works