The following code is applicable in case the matching result is just one row.
PHP Code:
<?php
$host="mysql16.000webhost.com";
$user ="a7246488_serg91";
$password = "xxxx";
$database ="a7246488_drinks";
$connection = mysql_connect($host, $user, $password) or die ("couldn't connect to server");
$db = mysql_select_db($database, $connection) or die("couldn't select database.");
$name = $_POST['term']; //name of the drink entered by a user
$query ="select NAME, INGREDIENTS, INSTRUCTIONS, CATEGORY from a1(1) where NAME = '%$name%'";
$result = mysql_query($query) or die ("Couldn't execute the query.");
// display $result in an array
$row = mysql_fetch_array($result);
if($row) {
echo'Name:'.$row['name'];
echo'<br>Ingredients: '.$row['Ingredients'];
echo'<br>instructions: '.$row['Instructions'];
echo'<br>category: '.$row['category'];
echo'<br>Image: '.$row['image'];
}
else {
echo "No matching result!";
}
?>