I have a database filled with values. I want to query and get certain values based on their title. I am using the LIKE query in sql to accomplish this.
For some reason, no results are coming up when I query 'new' in the search bar. The database has an item with the title: New Item
Html:
<form method="get" action="">
<input type="text" name="search" id="search" value="Search...">
<br>
<br>
<center>
<input type="submit" value="Search" name="searchsub" id="searchsub">
</center>
</form>
PHP:
<?php
if(isset($_GET['search']) && isset($_GET['searchsub']))
{
$search = $_GET['search'];
$results = mysqli_query($connection, "SELECT * FROM mi4 WHERE Title LIKE '$search'");
echo "<table><tr><td>Title</td><td>Teacher</td><td>Date</td><td>Description</td><td>Submitter</td></tr>";
while($row = mysqli_fetch_array($results))
{
echo "<tr><td>". $row['Title'] ."</td><td>". $row['Teacher'] ."</td><td>". $row['Date'] ."</td><td>". $row['Description'] ."</td><td>". $row['Submitter'] ."</td></tr>";
}
echo "</table>";
}
?>