count($setlist)) ) { while ($index <= count($TestCookie)) { setcookie("TestCookie[$index]"); $index++; } } } /* End Set Cookies */ /* Erase Cookie */ if (isset($ClearList) && isset($TestCookie)) { while (list ($name, $value) = each ($TestCookie)) { /* setcookie("TestCookie[$name]"); */ setcookie ("TestCookie[$name]", "", time()-7*24*3600); } } /* End Erase Cookie */ if (!isset($forward) && !isset($back) ) { header ("Location: database.php3"); exit; } } $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } /* Build Query String if the user clicked on search */ if (isset($search)) { $query = "select * from inventory where ID > 1 "; if ($song != '' && !isset($exact)) $query = $query . "AND song LIKE '%" . $song . "%' "; else if ($song != '') $query = $query . "AND song LIKE '" . $song . "' "; if ($band != '' && !isset($exact)) $query = $query . "AND band LIKE '%" . $band . "%' "; else if ($band != '') $query = $query . "AND band LIKE '" . $band . "' "; if ($album != '' && !isset($exact)) $query = $query . "AND album LIKE '%" . $album . "%' "; else if ($album != '') $query = $query . "AND album LIKE '" . $album . "' "; if ($category != '') $query = $query . "AND category LIKE '%" . $category . "%' "; $query = $query . "ORDER BY " . $sortby; } /* Show Song list - Retrieve Song information for Cookie values */ else { $query = "select * from inventory where ID = -12345 "; if (isset ($TestCookie) ) { reset($TestCookie); while (list ($name, $value) = each ($TestCookie)) { $query = $query . "OR ID = $value "; } } } /* End of Build Query */ /* print "$query
\n"; */ $retid = mysql_db_query($db, $query, $cid); #if (!$retid) { echo( mysql_error()); } if (!$retid) {$numrows=0;} else {$numrows = mysql_num_rows($retid);} /* Email Results */ if (isset($mail)) { $emailtext = "Song List for $custname <$email> (" . $numrows . " songs)\n\n"; while (($row = mysql_fetch_array($retid)) && $rowcount <= $rowlimit) { $emailtext = $emailtext . "$row[song] $row[band] $row[album]\n"; } if (isset($CC)) $sendto = $sendto . "," . $email; mail($sendto, "Centerstage Productions Song List", $emailtext, "From: $email"); header ("Location: after_inventory.php3"); exit; } /* End of Mail Output Loop */ ?>
|