";
}
?>
//if($table!="")
if($link)
{
echo"";
$sql_table_check = "SHOW TABLES LIKE '".$table."'";
$table_check_result = mysql_query($sql_table_check);
if($table_check_result)
{
if( mysql_num_rows($table_check_result))
{
//if($table!="")
//{
//$indexArray = split("-",$r);
//$theCondition="theIndex = 1000000";
//for($a=1;$a$line[1]";
//$relatedLink=str_replace('^^','',$relatedLink);
//echo "$relatedLink";
//}
//}
//}
//}
$querydb="select tblDatabaseDriven.fileName, tblDatabaseDriven.condition, tblDatabaseDriven.related, tblDatabaseDriven.dataTable, tblDatabaseDriven.measure2, tblDatabaseDriven.columns, tblDatabaseDriven.display,tblDatabaseDriven.location FROM tblDatabaseDriven where tblDatabaseDriven.fileName=\"$file\"";
$resultdb=mysql_query($querydb);
$relatedKey=-1;
if($resultdb)
{
$linedb=mysql_fetch_array($resultdb);
//$file=$linedb[0];
$theCondition=$linedb[1];
$relatedKey=$linedb[2];
$dataTable=$linedb[3];
$measure2 = $linedb[4];
$tableColumns = $linedb[5];
$display=$linedb[6];
$location=$linedb[7];
}
$seeRelated="";
if($relatedKey>0)
{
$queryRelated="select tblRelated.name, tblRelated.value FROM tblRelated where related=".$relatedKey;
$resultRelated=mysql_query($queryRelated);
$seeRelated="";
while(($lineRelated=mysql_fetch_array($resultRelated)))
{
$relatedFile=$lineRelated[0];
$relatedTitle=$lineRelated[1];
$seeRelated=$seeRelated." ".$relatedTitle.""."\n";
}
}
if($location=="europe")
{
$locationCondition=" AND (fb2.value LIKE \"%Europe,%\" OR fb2.name=\"Russia\" OR fb2.name=\"Turkey\") ";
}
if($location=="asia")
{
$locationCondition=" AND (fb2.value LIKE \"%Asia,%\" AND fb2.name!=\"Russia\" AND fb2.name!=\"Turkey\") ";
}
if($location=="africa")
{
$locationCondition=" AND (fb2.value LIKE \"%Africa,%\") ";
}
if($location=="oceania")
{
$locationCondition=" AND (fb2.value LIKE \"%Oceania,%\") ";
}
if($location=="south america")
{
$locationCondition=" AND (fb2.value LIKE \"%South America,%\") ";
}
if($location=="central america")
{
$locationCondition=" AND (fb2.value LIKE \"%Central America,%\") ";
}
if($location=="north america")
{
$locationCondition=" AND (fb2.value LIKE \"%North America,%\" OR fb2.name=\"Mexico\") ";
}
if($location=="middle east")
{
$locationCondition=" AND (fb2.value LIKE \"%Middle East,%\") ";
}
if($location=="caribbean")
{
$locationCondition=" AND (fb2.value LIKE \"%Caribbean,%\") ";
}
if($location=="americas")
{
$locationCondition=" AND (fb2.value LIKE \"%America,%\") ";
}
//include("lr_324/wa2.php");
//$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value tblDataCodes.fips FROM $table, fb0, fbURLs tblDataCodes WHERE (fb0.name=$table.name AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb0.value=\"independent\") order by $table.value $order)";
$query_b=mysql_query("SELECT * from $table LIMIT 1");
$columns = mysql_num_fields($query_b);
for ($i = 0; $i < $columns; $i++) {$field_array[] = mysql_field_name($query_b, $i);}
if($orderby==="value"){$orderby=$table.".value";}
if(!(strpos($measures,"Country")===false) && in_array("name",$field_array) && in_array("value",$field_array))
//if(strpos($measures,"Country")===0 && in_array("name",$field_array) && in_array("value",$field_array))
//if(strpos($table,"fb")===0)
{
// This statement differs from the one below by the condition ($table.value > 0 OR CHAR_LENGTH($table.value)>0 )
//$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value, tblDataCodes.fips FROM $table, fb0, fbURLs, tblDataCodes, fb2 WHERE (fb0.name=$table.name AND ($table.value > 0 OR CHAR_LENGTH($table.value)>0 )AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb2.name=fb0.name". $dependencyCondition . $locationCondition .") order by $orderby $order";
$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value, tblDataCodes.fips FROM $table, fb0, fbURLs, tblDataCodes, fb2 WHERE (fb0.name=$table.name AND ($table.value > 0)AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb2.name=fb0.name". $dependencyCondition . $locationCondition .") order by $orderby $order";
}
else
{
$columnCheck=true;
$theColumns="";
$arrayOfMeasures=split("--",$measures);
foreach ($arrayOfMeasures as $aMeasure)
{
$theColumns=$theColumns.", ".$aMeasure;
if(!in_array(strtolower($aMeasure), $field_array)){$columnCheck=False;}
}
$theColumns=substr($theColumns,1);
echo"";
if(strlen($tableColumns)>1)
{
$columnCheck=true;
$theColumns=$tableColumns;
}
$orderPhrase="";
if(strlen($orderby)>1)
{
$orderPhrase="order by $orderby $order";
}
if($columnCheck)
{
if(strlen($theCondition)>3)
{
$query1 = "SELECT $theColumns FROM $table where $theCondition $orderPhrase";
}
else
{
$query1 = "SELECT $theColumns FROM $table $orderPhrase";
}
}
else
{
if(strlen($theCondition)>1)
{
$query1 = "SELECT * FROM $table where $theCondition $orderPhrase";
}
else
{
$query1 = "SELECT * FROM $table $orderPhrase";
}
}
}
if($table=="table_expensive_streets")
{
$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value, tblDataCodes.fips, $table.location FROM $table, fb0, fbURLs, tblDataCodes, fb2 WHERE (fb0.name=$table.name AND $table.value > 0 AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb2.name=fb0.name". $dependencyCondition . $locationCondition .") order by $table.value $order";
}
if($measures=="Population - Muslim and other faiths")
{
$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value, tblDataCodes.fips, fb70.value FROM $table, fb0, fbURLs, tblDataCodes, fb2, fb70 WHERE (fb0.name=$table.name AND $table.value > 0 AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb2.name=fb0.name AND fb0.name=fb70.name AND (fb70.value LIKE \"Muslim%\" OR fb70.value LIKE \"Sunni%\") ". $dependencyCondition . $locationCondition .") order by $table.value $order";
}
if($measures=="Population - Christian and other faiths")
{
$query1 = "SELECT $table.name, $table.value, fb0.value, fbURLs.value, tblDataCodes.fips, fb70.value FROM $table, fb0, fbURLs, tblDataCodes, fb2, fb70 WHERE (fb0.name=$table.name AND $table.value > 0 AND fb0.name = fbURLs.name AND fb0.name = tblDataCodes.name AND fb2.name=fb0.name AND fb0.name=fb70.name AND (fb70.value LIKE \"Christian%\" OR fb70.value LIKE \"Roman%\" OR fb70.value LIKE \"Protestant%\" OR fb70.name LIKE \"Nigeria\" ) ". $dependencyCondition . $locationCondition .") order by $table.value $order";
}
define("sql_error_reporting",true);
//result1 = mysql_query($query1) or mail("info@aneki.com", "countries2 error", "Sql error of ".$_SERVER["SCRIPT_NAME"].". Call to `$table` in ".__FILE__." ".$_GET["file"]." on line: ".__LINE__."
".mysql_error()."
SQL:
$query1
");
$result1 = mysql_query($query1);
echo"";
if($result1)
{
$decimal='.';
$separator=',';
$position=0;
$num_rows=0;
if($number=="all")
{
$num_rows = mysql_num_rows($result1);
}
else
{
$num_rows = $number;
}
if($table=="table_expensive_streets")
{
echo"| | Country | Location | Rent (US $/sq.ft/yr) |
";
$theRows="";
while (($line = mysql_fetch_array($result1)) && ($position<$num_rows) )
{
$position=$position+1;
$modulus=($position%2)+1;
$theNumber=number_format($line[1],$places,$decimal,$separator);
//$countryLink=str_replace("http://www.aneki.com/","/",$line[5]);
if($cntdn=="y")
{
$theRows="| $position. | $line[3]
)."-flag.png\") | $line[5] | $unit$theNumber |
".$theRows;
}
else
{
$theRows=$theRows."| $position | $line[3] | $unit$theNumber |
";
}
}
echo"$theRows";
echo"
";
}
else
{
//echo"| | ";
//echo"| view as: list / slideshow / map | |
";
//echo"| view as: list / map | |
";
if(strrpos($display,"slide")===false)
{
echo"";
echo"";
if($map=="on")
{
print"$mapCode";
}
echo"| ▲ | ";
$numberOfMeasures=0;
foreach ($arrayOfMeasures as $aMeasure) {
$aMeasure=urldecode($aMeasure);
//echo"$aMeasure | ";
if($numberOfMeasures==0)
{
echo"$aMeasure | ";
}
else
{
echo"$aMeasure | ";
}
$numberOfMeasures=$numberOfMeasures+1;
}
echo"
";
$theRows="";
$theTable="";
while (($line = mysql_fetch_array($result1)) && ($position<$num_rows) )
{
$position=$position+1;
$modulus=($position%2)+1;
$theNumber=number_format($line[1],$places,$decimal,$separator);
//$theRows="| $position. | ";
$theRows="
| $position. | ";
//$theRows="
| $position. | ";
for($kl=0;$kl<$numberOfMeasures;$kl++)
{
$theEntry=$line[$kl];
if(!(strrpos($arrayOfMeasures[$kl],"Height") === FALSE)){$feet=floor($theEntry/12);$inches=$theEntry%12;$theEntry=$feet."-".$inches;}
if($arrayOfMeasures[$kl]==="Country" && !(strpos($query1,"fbURLs.value")===false))
//if($arrayOfMeasures[$kl]==="Country" && strpos($measures,"Country")===0)
{
$theCountryLink=$line[3];
$theCountryLink=str_replace("https://www.aneki.com/","/",$theCountryLink);
if(!(strpos($theCountryLink,"
";
$theFlagImage="
";
//$theFlagImage="
";
//$theEntry="| $theFlagImage | $theCountryLink |
";
//$theEntry="| $theFlagImage | $theCountryLink |
";
//$theEntry="| $theFlagImage | $theCountryLink |
";
//$theEntry="| $theFlagImage | $theCountryLink |
";
$theEntry="";
}
}
if(isset($arrayOfDecimals[$kl]) && !($arrayOfMeasures[$kl]==="Year"))
{
if($arrayOfDecimals[$kl]==="" && is_numeric($theEntry))
{
$theEntry=number_format($theEntry,0);
}
else if(!($arrayOfDecimals[$kl]==="") && is_numeric($theEntry))
{
$theEntry=number_format($theEntry,$arrayOfDecimals[$kl]);
}
}
if(isset($arrayOfUnits[$kl]))
{
if($kl===0)
{
//$theRows=$theRows."$arrayOfUnits[$kl]$theEntry | ";
$theUnit=rawurldecode($arrayOfUnits[$kl]);
$theRows=$theRows."$theUnit$theEntry | ";
//$theRows=$theRows."$arrayOfUnits[$kl]$theEntry | ";
}
if($kl>0)
{
$theUnit=rawurldecode($arrayOfUnits[$kl]);
//$theRows=$theRows."$arrayOfUnits[$kl]$theEntry | ";
$theRows=$theRows."$theUnit$theEntry | ";
//$theRows=$theRows."$arrayOfUnits[$kl]$theEntry | ";
}
}
}
if($cntdn=="y")
{
$theTable=$theRows.$theTable;
}
else
{
$theTable=$theTable.$theRows;
}
}
$selected10="";
$selected25="";
$selected50="";
$selected100="";
$selectedAll="";
if($number==="10"){$selected10="SELECTED";}
if($number==="25"){$selected25="SELECTED";}
if($number==="50"){$selected50="SELECTED";}
if($number==="100"){$selected100="SELECTED";}
if($number==="all"){$selectedAll="SELECTED";}
$selectForm="
";
$theTable=$theTable."
| ▼ | | $selectForm |
";
if($number==5)
{
$thePrevious="";
if($file!="")
{
$thePrevious=" Previous |
6 -10 | 1- 5 | ";
}
$theTable=$theTable."
|
$thePrevious
single page
|
";
}
if(!strrpos($display,"slide"))
{
echo"$theTable";
echo"
";
}
}
}
}
}
}
mysql_close($link);
}
?>
//if ($detect->isMobile()) {
//print"
//
//
//";
//}
//else
//{
//print"
//
//";
//}
?>
if ($detect->isMobile()) {
include("templates/template_social_sharing_mobile.html");
}
else
{
include("templates/template_social_sharing.html");
}
?>
if(strlen($seeRelated)>10)
{
print"
See Related
";
echo"$seeRelated";
}
?>
if ($detect->isMobile()) {
print"
";
}
else
{
//begin detecting geo location
function Dot2LongIP ($IPaddr)
{
if ($IPaddr == "") {
return 0;
} else {
$ips = split ("\.", "$IPaddr");
return ($ips[3] + $ips[2] * 256 + $ips[1] * 65536 + $ips[0]
*16777216); }
}
$ipnum= Dot2LongIp(getenv('REMOTE_ADDR') );
include("lr_324/wa3.php");
$query= "SELECT cn FROM geoip WHERE $ipnum >= start AND
$ipnum <= end";
$result = mysql_query($query);
$country="";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$country = $row['cn'];
}
//end detecting geo location
echo"
See Also
";
echo"
";
mysql_close($link);
print"
";
}
?>
if ($detect->isMobile()) {
// any mobile platform
}
else
{
include("templates/template_right.html");
}
?>
if ($detect->isMobile()) {
include("templates/template_footer_mobile.html");
}
else
{
include("templates/template_footer.html");
}
?>