本文整理汇总了PHP中Connection::tableExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::tableExists方法的具体用法?PHP Connection::tableExists怎么用?PHP Connection::tableExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::tableExists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
</p>
</fieldset>
<fieldset>
<legend>Sources location</legend>
<table class="sources">
<tr>
<th>Name</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Altitude</th>
<th>City</th>
<th>Country</th>
</tr>
<?php
require_once '../require/class.Connection.php';
if (Connection::tableExists('source_location')) {
require_once '../require/class.Source.php';
$alllocations = Source::getAllLocationInfo();
foreach ($alllocations as $location) {
?>
<tr>
<input type="hidden" name="source_id[]" value="<?php
print $location['id'];
?>
" />
<td><input type="text" name="source_name[]" value="<?php
print $location['name'];
?>
" /></td>
<td><input type="text" name="source_latitude[]" value="<?php
print $location['latitude'];
示例2: check_version
public static function check_version($update = false)
{
global $globalDBname;
$version = 0;
if (Connection::tableExists('aircraft')) {
if (!Connection::tableExists('config')) {
$version = '1';
if ($update) {
return self::update_from_1();
} else {
return $version;
}
} else {
$Connection = new Connection();
$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
try {
$sth = Connection::$db->prepare($query);
$sth->execute();
} catch (PDOException $e) {
return "error : " . $e->getMessage() . "\n";
}
$result = $sth->fetch(PDO::FETCH_ASSOC);
if ($update) {
if ($result['value'] == '2') {
$error = self::update_from_2();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '3') {
$error = self::update_from_3();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '4') {
$error = self::update_from_4();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '5') {
$error = self::update_from_5();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '6') {
$error = self::update_from_6();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '7') {
$error = self::update_from_7();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} elseif ($result['value'] == '8') {
$error = self::update_from_8();
if ($error != '') {
return $error;
} else {
return self::check_version(true);
}
} else {
return '';
}
} else {
return $result['value'];
}
}
} else {
return $version;
}
}
示例3: Connection
<fieldset>
<legend>Sources location</legend>
<table class="sources">
<tr>
<th>Name</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Altitude</th>
<th>City</th>
<th>Country</th>
</tr>
<?php
require_once '../require/class.Connection.php';
$Connection = new Connection();
if ($Connection->db != NULL) {
if ($Connection->tableExists('source_location')) {
require_once '../require/class.Source.php';
$Source = new Source();
$alllocations = $Source->getAllLocationInfo();
foreach ($alllocations as $location) {
?>
<tr>
<input type="hidden" name="source_id[]" value="<?php
print $location['id'];
?>
" />
<td><input type="text" name="source_name[]" value="<?php
print $location['name'];
?>
" /></td>
<td><input type="text" name="source_latitude[]" value="<?php
示例4: getAllCountries
/**
* Gets a list of all countries (airline, departure airport & arrival airport)
*
* @return Array list of countries
*
*/
public function getAllCountries()
{
$Connection = new Connection();
if ($Connection->tableExists('countries')) {
$country_array = array();
$query = "SELECT countries.name AS airport_country\n\t\t\t\t\t\t\t\tFROM countries\n\t\t\t\t\t\t\t\tORDER BY countries.name ASC";
$sth = $this->db->prepare($query);
$sth->execute();
$temp_array = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$temp_array['country'] = $row['airport_country'];
$country_array[$row['airport_country']] = $temp_array;
}
} else {
$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country\n\t\t\t\t\t\t\t\tFROM spotter_output\n\t\t\t\t\t\t\t\tWHERE spotter_output.departure_airport_country <> '' \n\t\t\t\t\t\t\t\tORDER BY spotter_output.departure_airport_country ASC";
$sth = $this->db->prepare($query);
$sth->execute();
$temp_array = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$temp_array['country'] = $row['airport_country'];
$country_array[$row['airport_country']] = $temp_array;
}
$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country\n\t\t\t\t\t\t\t\tFROM spotter_output\n\t\t\t\t\t\t\t\tWHERE spotter_output.arrival_airport_country <> '' \n\t\t\t\t\t\t\t\tORDER BY spotter_output.arrival_airport_country ASC";
$sth = $this->db->prepare($query);
$sth->execute();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) {
$temp_array['country'] = $row['airport_country'];
$country_array[$row['country']] = $temp_array;
}
}
$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country\n\t\t\t\t\t\t\t\tFROM spotter_output \n\t\t\t\t\t\t\t\tWHERE spotter_output.airline_country <> '' \n\t\t\t\t\t\t\t\tORDER BY spotter_output.airline_country ASC";
$sth = $this->db->prepare($query);
$sth->execute();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) {
$temp_array['country'] = $row['airline_country'];
$country_array[$row['country']] = $temp_array;
}
}
}
return $country_array;
}
示例5: getDataFromDB
/**
* Executes the SQL statements to get the spotter information
*
* @param String $query the SQL query
* @param String $limit the limit query
* @return Array the spotter information
*
*/
public static function getDataFromDB($query, $params = array(), $limitQuery = '')
{
global $globalSquawkCountry, $globalIVAO;
if (!isset($globalIVAO)) {
$globalIVAO = FALSE;
}
date_default_timezone_set('UTC');
if (!is_string($query)) {
return false;
}
if ($limitQuery != "") {
if (!is_string($limitQuery)) {
return false;
}
}
$Connection = new Connection();
try {
$sth = Connection::$db->prepare($query . $limitQuery);
$sth->execute($params);
} catch (PDOException $e) {
printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query . $limitQuery);
exit;
}
// $num_rows = count($sth->fetchAll());
$num_rows = 0;
$spotter_array = array();
$temp_array = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$num_rows++;
$temp_array = array();
if (isset($row['spotter_live_id'])) {
$temp_array['spotter_id'] = $row['spotter_live_id'];
} elseif (isset($row['spotter_archive_id'])) {
$temp_array['spotter_id'] = $row['spotter_archive_id'];
} else {
$temp_array['spotter_id'] = $row['spotter_id'];
}
$temp_array['flightaware_id'] = $row['flightaware_id'];
if (isset($row['modes'])) {
$temp_array['modes'] = $row['modes'];
}
$temp_array['ident'] = $row['ident'];
if (isset($row['registration']) && $row['registration'] != '') {
$temp_array['registration'] = $row['registration'];
} elseif (isset($temp_array['modes'])) {
$temp_array['registration'] = Spotter::getAircraftRegistrationBymodeS($temp_array['modes']);
} else {
$temp_array['registration'] = '';
}
$temp_array['aircraft_type'] = $row['aircraft_icao'];
$temp_array['departure_airport'] = $row['departure_airport_icao'];
$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
$temp_array['latitude'] = $row['latitude'];
$temp_array['longitude'] = $row['longitude'];
if (Connection::tableExists('countries')) {
$country_info = Spotter::getCountryFromLatitudeLongitude($temp_array['latitude'], $temp_array['longitude']);
if (is_array($country_info) && isset($country_info['name']) && isset($country_info['iso2'])) {
$temp_array['country'] = $country_info['name'];
$temp_array['country_iso2'] = $country_info['iso2'];
}
}
$temp_array['waypoints'] = $row['waypoints'];
if (isset($row['route_stop'])) {
$temp_array['route_stop'] = $row['route_stop'];
if ($row['route_stop'] != '') {
$allroute = explode(' ', $row['route_stop']);
foreach ($allroute as $route) {
$route_airport_array = Spotter::getAllAirportInfo($route);
if (isset($route_airport_array[0]['name'])) {
$route_stop_details['airport_name'] = $route_airport_array[0]['name'];
$route_stop_details['airport_city'] = $route_airport_array[0]['city'];
$route_stop_details['airport_country'] = $route_airport_array[0]['country'];
$route_stop_details['airport_icao'] = $route_airport_array[0]['icao'];
$temp_array['route_stop_details'][] = $route_stop_details;
}
}
}
}
$temp_array['altitude'] = $row['altitude'];
$temp_array['heading'] = $row['heading'];
$heading_direction = Spotter::parseDirection($row['heading']);
if (isset($heading_direction[0]['direction_fullname'])) {
$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
}
$temp_array['ground_speed'] = $row['ground_speed'];
$temp_array['image'] = "";
$temp_array['image_thumbnail'] = "";
$temp_array['image_source'] = "";
$temp_array['image_copyright'] = "";
if (isset($row['highlight'])) {
$temp_array['highlight'] = $row['highlight'];
} else {
//.........这里部分代码省略.........
示例6: header
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
include_once 'require/libs/geoPHP/geoPHP.inc';
if (isset($_GET['download'])) {
header('Content-disposition: attachment; filename="airspace.geojson"');
}
header('Content-Type: text/javascript');
$Connection = new Connection();
if (!Connection::tableExists('airspace')) {
die;
}
if (isset($_GET['coord'])) {
$coords = explode(',', $_GET['coord']);
$query = "SELECT *, AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
try {
$sth = Connection::$db->prepare($query);
$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
} catch (PDOException $e) {
return "error";
}
} else {
$query = "SELECT *, AsWKB(SHAPE) AS wkb FROM airspace";
try {
$sth = Connection::$db->prepare($query);
$sth->execute();
} catch (PDOException $e) {
return "error";
}
}
示例7: wkb_to_json
<?php
require 'require/class.Connection.php';
include_once 'require/libs/geoPHP/geoPHP.inc';
if (isset($_GET['download'])) {
header('Content-disposition: attachment; filename="airspace.geojson"');
}
header('Content-Type: text/javascript');
$Connection = new Connection();
if (!$Connection->tableExists('airspace')) {
die;
}
if (isset($_GET['coord'])) {
$coords = explode(',', $_GET['coord']);
$query = "SELECT *, AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
try {
$sth = $Connection->db->prepare($query);
$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
} catch (PDOException $e) {
return "error";
}
} else {
$query = "SELECT *, AsWKB(SHAPE) AS wkb FROM airspace";
try {
$sth = $Connection->db->prepare($query);
$sth->execute();
} catch (PDOException $e) {
return "error";
}
}
function wkb_to_json($wkb)