Hi, I am trying to query a MySql database based on which search fields are filled in and ignoring those that aren't. I have only got as far as the first part and it isn't working, could anyone tell me why?
It doesn't seem to be finding anything in the database
if ((isset($_POST['band'])) && (!isset($_POST['day'])) && (!isset($_POST['month'])) && (!isset($_POST['year'])) && (!isset($_POST['location'])))
{
$result = mysql_query("SELECT * FROM gigs WHERE band LIKE '%$band%'");
while($row = mysql_fetch_array($result))
{
$page = sprintf( "<a href='http://www.example.com/%s'>%s</a>" , $row['PageName'] , $row['band'] ) ;
echo 'Band Name: ';
echo $row['band'] ." " . " " . $row['day'] . " " . $row['month'] . " " . $row['year']. " " . $row['Genre'];
echo $page;
echo "<br />";
}
}
else echo 'No gigs found' ;
Thanks in advance