I'm new at this and this is my first attempt.
I have a form set up to allow users to enter data, and it works fine. Now I'm trying to set up a form to allow the user to query for several items. I'm getting an:
Warning: 0 is not a MySQL result index in /home/powwows/public_html/dancing/drumgroupsquery.php3 on line 41
The form to enter is
Entry Forum
The search form is
Search Forum
Here is my PHP Query Script:
<head>
<title>Drum Groups</title>
</head>
<body text="#990000">
<?
//connect to database
$hostname = "localhost";
$username = "username";
$password = "password";
$dbName = "dbname";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to database");
@mysql_select_db("$dbName") or die("Unable to select database");
if ($drumname == "")
{$drumname = '%';}
if ($state == "")
{$state = '%';}
if ($headsinger == "")
{$headsinger = '%';}
if ($style == "")
{$style = '%';}
$result = mysql_query ("SELECT * FROM drum
WHERE drumname LIKE '$drumname%'
AND state LIKE '$state%'
AND headsinger LIKE '$headsinger%'
AND style LIKE '$style%'
AND (drumname LIKE '$drumname' OR drumname IS NULL)
AND (state LIKE '$state' OR state IS NULL)
AND (headsinger LIKE '$headsinger' OR headsinger IS NULL)
AND (style LIKE '$style' OR style IS NULL)
");
if ($row = mysql_fetch_array($result)) {
do {
print $row["drumname"];
print (" ");
print $row["state"];
print ("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no drum groups were found!";}
include("menu2.html");
?>
</body>
thanks for the help