I want a user to be able to search by letter. Can't get this code to work. I have a page search.php with <a href=search2.php?id='A>A</a>
then a page called search2.php with this code:
<?
mysql_connect("mysql","name","password");
mysql_select_db("ims_search");
$name=$_GET['id'];
"Your search found "; $query = mysql_query("SELECT * FROM artist WHERE artist_name LIKE
'$name%'"); $rows = mysql_num_rows($query); echo $rows; echo " result(s)";echo "<br>";
$result = mysql_query("SELECT * FROM artist WHERE artist_name LIKE '$name%'");
while($r=mysql_fetch_array($result))
{
$artist_name=$r["artist_name"];
$clean = str_replace(" ","",$artist_name);
echo "<a href='/$clean'>$artist_name</a>";
echo "<br>";
}
?>
When I run search.php I get "0 results", when I should get all the artist who's name starts with the letter 'A'. Any help would be greatly appreciated.