Lodge Locator Search Results

[insert_php]
$username = “okglm”;
$password = “Mas0nic”;
$hostname = “localhost”;

$dbhandle = mysql_connect($hostname, $username, $password)
or die(“Unable to connect to MySQL”);

$selected = mysql_select_db(“okglm”,$dbhandle)
or die(“Could not select okglm”);

$metode = mysql_real_escape_string($_POST[‘metode’]);
$search = mysql_real_escape_string($_POST[‘search’]);
$sql = “SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE TRIM(LEADING ‘0’ FROM $metode) = ‘$search’ GROUP BY strLodgeName LIMIT 50”;
$sql = “SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE $metode like ‘%$search%’ GROUP BY strLodgeName LIMIT 50”;
if ($results = mysql_query($sql)) {
if (mysql_num_rows($results)) {
while ($row = mysql_fetch_assoc($results)) {
echo “

“;
echo “


Your Grand Lodge of Oklahoma Lodge Locator Search Results



Lodge ID Number

Lodge Name
Click
Button To View Lodge Details

City

District
Number
“;
echo $row[“intLodgeNumber”];
echo “
“;
echo $row[“strLodgeName”];
echo “
“;
echo “
“;
echo $row[“strLodgeLocationCity”];
echo “
“;
echo ltrim($row[“intDistrictID”], ‘0’);
}
} else {
echo “No records found”;
}
} else {
echo “Query failed
” . mysql_error() . “
$sql”;
}
[/insert_php]