the beginning query " . $sql2 . " > end of query
";
echo "this is the bottom of the view state count function";
$sql2 = 'SELECT COUNT(DISTINCT bizState) FROM ' . $databaseNiche . '';
// orig $sql2 = 'SELECT COUNT(DISTINCT bizState) FROM ' . $databaseNiche . '';
// echo $sql2;
// orig -> $result2 = mysqli_query($sql2);
$result2 = mysqli_query($con, $sql2);
$row2 = mysqli_fetch_row($result2);
$num_of_items = $row2[0];
$theItemTotal = $num_of_items / 4;
$totalDividedBy4 = round($theItemTotal,0);
// echo "the total amount is " . $totalDividedBy4;
return $totalDividedBy4;
} // ViewStateCount();
// echo "top of view states function";
function ViewStates1() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con, $query;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC ";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$countminusone = $row['COUNT(bizState)'] - 1;
echo "
";
}
}
function ViewStates1ORIG() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con, $query;
$query = mysqli_query($con,"SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT 0, $totalDividedBy4");
// echo $query;
// ORIG: $query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT 0, $totalDividedBy4 ";
// $query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT 0, $totalDividedBy4 ";
// echo $query; exit();
$result = mysqli_query($query);
// echo $query; exit();
while ($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {
$countminusone = $row['COUNT(bizState)'] - 1;
echo "";
}
}
function ViewStates2() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4, $totalDividedBy4";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
echo "";
}
}
function ViewStates2ORIG() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
// $queryORIG = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4, $totalDividedBy4";
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4, $totalDividedBy4";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
echo "";
}
}
function ViewStates3() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $totalDividedBy4NEW, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
$totalDividedBy4NEW = $totalDividedBy4 + $totalDividedBy4;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4NEW, $totalDividedBy4";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
echo "";
}
}
function ViewStates3ORIG() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4, $totalDividedBy4NEW, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
$totalDividedBy4NEW = $totalDividedBy4 + $totalDividedBy4;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4NEW, $totalDividedBy4";
/// echo $query;
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "";
}
}
function ViewStates4() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4NEW, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
$totalDividedBy4NEW2 = $totalDividedBy4NEW + $totalDividedBy4;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4NEW2, $totalDividedBy4";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
echo "";
}
}
function ViewStates4ORIG() {
global $pageName, $mainKeyword, $databaseNiche, $mainKeyword, $totalDividedBy4NEW, $totalDividedBy4, $SatelocationIconLG, $stateLocationIconStyleLG, $con;
$totalDividedBy4NEW2 = $totalDividedBy4NEW + $totalDividedBy4;
$query = "SELECT bizState FROM " . $databaseNiche . " GROUP BY bizState ORDER BY bizState ASC LIMIT $totalDividedBy4NEW2, $totalDividedBy4";
// echo $query;
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "";
}
}
// BEGIN GEO IP FUNCTIONS
/* file_get_contents do the "GET" */
// file from freegeoip.com
$theUserIpAddress = $_SERVER['REMOTE_ADDR'];
// testing :::::::::::::
// $theUserIpAddress = '173.245.64.80'; // san jose ip address for testing
// $jsonReceived = @file_get_contents('http://freegeoip.net/json/'.$theUserIpAddress);
// check to see if the files exists from the server ::::::::::::
if($jsonReceived) {
//
// and if result if it doesnt exist in the db
// detected loction img icon in popup
// maybe add logic to display if user location matches state page selected
// diff icon for your location and icon for area
/* Array from json */
$results = json_decode_nice($jsonReceived);
$thePartsArray = array($results);
// define the variables and names to defined varname for usage
foreach($thePartsArray[0] as $key=>$value) { $$key = $value; }
$userState = $region_code;
$userCity = $city;
// $city = 'test';
// print_r($thePartsArray);
} else {
// hide map if file not there
$displayMap = 'NO';
}
/* function to decode json with whitespaces or not used for map json above */
function json_decode_nice($json, $assoc = FALSE){
$json = @str_replace(array("\n","\r"),"",$json);
$json = @preg_replace('/([{,])(\s*)([^"]+?)\s*:/','$1"$3":',$json);
return @json_decode($json,$assoc);
}
// END GEO IP FUNCTIONS
function displayLatLongListings22() {
Global $table, $state, $city, $bizName, $myLongitude, $myLatitude, $bizID, $bizCity2, $bizAddr, $locationsMapsPageName, $userState, $userCity, $bizPhone;
if($userState == 'CA') {
$query = "SELECT * FROM $table where bizState LIKE '%$userState%' AND bizCity LIKE '%$userCity%' ORDER BY myLatitude ASC ";
} else {
$query = "SELECT * FROM $table where bizState LIKE '%$userState%' ORDER BY myLatitude ASC ";
}
// $query = "SELECT * FROM $table where bizState LIKE '%$userState%' ORDER BY myLatitude ASC ";
// echo $query;
$result = @mysql_query($query);
while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
$bizPhone = $row['bizPhone'];
// $bizState = $row['bizState'];
$bizCity2 = ucwords(strtolower($row['bizCity']));
$bizAddr = ucwords(strtolower($row['bizAddr']));
$bizName = $row['bizName'];
$bizName = str_replace("'", "", $row['bizName']);
$myLongitude = $row['myLongitude'];
$myLatitude = $row['myLatitude'];
$bizID = $row['bizID'];
echo "L.marker([";
echo $myLongitude;
echo ",";
echo $myLatitude;
echo "], {icon: foodMarker})";
echo ".addTo(map).bindPopup('";
echo $bizName . " located at:
" . $bizAddr ."
". $bizCity2 . " " . $bizPhone;
echo "
Get Directions '); ";
}
// echo "the city is " . $city;
}
function turnOnorOffMap() {
Global $table, $state, $city, $bizName, $myLongitude, $myLatitude, $bizID, $bizAddr, $bizCity, $locationsMapsPageName, $userState, $userCity, $displayMap, $con;
// $query = "SELECT bizID FROM $table where bizState LIKE '%$userState%' ORDER BY myLatitude ASC ";
$query = "SELECT bizID FROM $table where bizState LIKE '%$userState%' ORDER BY myLatitude ASC ";
// echo $query;
$result = @mysqli_query($con, $query);
while ($row = @mysqli_fetch_array($result, MYSQL_ASSOC)) {
$bizID = $row['bizID'];
}
if(!$bizID) { $displayMap = 'NO'; }
}
?>
U.S. Moose Lodge Locations