Searchable Database

[insert_php]

echo “

Michigan Bird Records Committee Searchable Database

“;
echo “This search engine queries all records recognized by the MBRC; searches can be made only for species that are, or used to be, on the MBRC Review List.

“;
echo “Disclaimers: All data are unofficial unless verified by the secretary; also, search results should not be considered exhaustive (because they do not account for the most recent MBRC actions – those that occurred since the last database update).

“;
echo “Instructions: Searches can be made by entering all or part of a species name or county name. For the most restrictive output, type in the complete species name rather than a fragment (e.g. ‘Mew Gull’ instead of ‘Gull’). For unidentified frigatebirds type ‘Fregata’, for unidentified sulids use ‘sulid’, for unidentified Plegadis ibises use ‘Plegadis’, and for unidentified Aechmophorus grebes use ‘Aechmophorus’. All accepted records of seasonal review species (such as Baird’s Sandpiper) and review subspecies (such as ‘Krider’s’ and ‘Harlan’s’ Red-tailed Hawks, ‘Richardson’s’ Merlin, ‘Great White’ Great Blue Heron, ‘Audubon’s’ Yellow-rumped Warbler, and ‘Yellow’ Palm Warbler) are included. Junco subspecies (Gray-headed, Pink-sided, and Oregon) and subspecies lacking any accepted records for Michigan are excluded. Leaving the box blank and hitting enter will reveal all records in the database.

“;

echo “Database updated 26 November 2015.”;

echo “



“;

$todo=$_POST[‘todo’];

// Get keyword passed from Query String ?keyword=gull

if($_REQUEST[‘keyword’] == “”)
{
// no keyword entered
// echo “You did not enter a keyword.”;
}
else
{
$search_text = $_REQUEST[‘keyword’];
}

// Get keyword from input box typed in

if($_POST[‘search_text’] == “”)
{
// no keyword entered
// echo “You did not enter a keyword.”;
}
else
{
$search_text=$_POST[‘search_text’];
}

if((isset($todo) and $todo==”search”) or $search_text <> “” )
{
$search_text=ltrim($search_text);
$search_text=rtrim($search_text);
$q=” species like ‘%$search_text%’ or county like ‘%$search_text%'”;
$query=”select * from searchable where $q order by pkid”;
echo “Records containing the keyword ‘$search_text'”;
echo “
“;
$username=’mibird5_wp700′;
$password=’ThanklessJob4321′;
$database=’mibird5_wp700′;

mysql_connect(‘localhost’,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);

// echo “Executing query: ‘$query'”;

$nt=mysql_query($query);
mysql_close();
echo mysql_error();
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

while($row=mysql_fetch_array($nt))
{
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
if (empty($row[photo_link]))
{
echo “

“;
}
else
{
echo “

“;
}
echo “

“;
}
echo “

State Record No. Species (number of individuals) Date County Photo link
“;
echo “$row[record_number]
“;
echo “$row[species] ($row[number_of_individuals])
“;
echo “$row[date]
“;
echo “$row[county]
“;
echo “$row[photo_link]

“;
// End if form submitted
}else{
}
echo “
*Special thanks to Nathan Stouffer for creating this search engine.
“;
[/insert_php]