Skip to Content

scratch practice

[insert_php]

echo “This database include includes all records currently accepted by the MARC. You can search by species, county, year, and observer (last name only).

“;

echo “Updated 28 January 2017.”;

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%’ or observers like ‘%$search_text%’
or marc_number like ‘%$search_text%'”;
$query=”select * from marc_database where $q order by pkid”;
echo “
“;
$username=”maavia5″;
$password=”pare10181947marblehead”;
$database=”maavia5_marc”;

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 “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

echo “

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

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
}
echo “

“;
echo “

MARC numberSpecies#LocationCountyArrival dateDeparture dateObserversReport
“;
echo “$row[marc_number]
“;
echo “$row[species]
“;
echo “$row[count]
“;
echo “$row[location]
“;
echo “$row[county]
“;
echo “$row[arrival_date]
“;
echo “$row[departure_date]
“;
echo “$row[observers]
$row[report]

“;
// End if form submitted
}else{
}
[/insert_php]

Back to top