I'm getting an error of could not execute the query. not sure what im doing wrong on this query. i'm just messing around with search through a database ofa drink recipe site im building. I wanna use a search option on this website.
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 = "drink"; //user types in the name of drink
$query ="select NAME, INGREDIENTS, INSTRUCTIONS, CATEGORY from a1(1) where NAME = '%$name'";
$result = mysql_query($query) or die ("Couldn't execute the query.");
$row = mysql_num_rows($result);
//display the result of the table
$row = mysql_fetch_array($result);
//this is where I think is where im going wrong
echo'Name:'.$row['name'];
echo'<br>Ingredients: '.$row['Ingredients'];
echo'<br>instructions: '.$row['Instructions'];
echo'<br>category: '.$row['category'];
echo'<br>Image: '.$row['image'];
?>
HTML Code:
<body>
<FORM action="search.php" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" name="submit" value="submit" />
</body>