I'm trying to create a search function. I've been researching and editing after getting a few errors and now I get no errors but nothing is echoed. I'm completely stumped I was wondering if anyone knew what was wrong with it. Thanks ahead of time! :D
<html>
<head>
<title>Search Query</title>
</head>
<body>
<?php
$con = mysql_connect ("localhost", "root", "");
mysql_select_db ("music", $con);
if (!$con)
{
die ("Could not connect: " . mysql_error());
}
$sql = mysql_query("SELECT * FROM entries WHERE Title LIKE '%term%'") or die (mysql_error());
while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)){
echo 'Title: ' .$row['Title'];
echo '<br /> Artist: ' .$row['Artist'];
echo '<br /> Album: '.$row['Album'];
echo '<br /> Location: '.$row['Location'];
echo '<br /> Media: '.$row['Media'];
}
mysql_close($con);
?>
</body>
</html>
This is the form i use:
<form action="search.php" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" name="submit" value="Submit" />
</form>