当前位置: 首页>>代码示例>>PHP>>正文


PHP getDatabaseConnection函数代码示例

本文整理汇总了PHP中getDatabaseConnection函数的典型用法代码示例。如果您正苦于以下问题:PHP getDatabaseConnection函数的具体用法?PHP getDatabaseConnection怎么用?PHP getDatabaseConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getDatabaseConnection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getQCEWQuarter

 public function getQCEWQuarter($stfips, $areatype, $area, $periodyear, $periodtype, $period)
 {
     $link = getDatabaseConnection();
     $query = sprintf(" SELECT ind.*, format(ind.estab, '###,###,###.##') as estab_fmt,  \n                             format(ind.totwage, '###,###,###.##') as totwage_fmt, \n                             format(ind.avgwkwage, '###,###,###.##') as avgwage_fmt, \n                             format(ind.avgemp, '###,###,###.##') as avgemp_fmt, ic.codetitle \n                             FROM wid.industry ind\n                             INNER JOIN wid.indcodes ic ON ind.indcodty = ic.codetype \n                             AND ind.indcode = ic.code\n                             WHERE ind.stfips = '%s'\n                             AND ind.areatype = '%s'\n                             AND ind.area = '%s'\n                             AND ind.periodyear = '%s'\n                             AND ind.periodtype = '%s'\n                             AND ind.period = '%s'\n                             ORDER BY indcode, period ", mysql_real_escape_string($stfips), mysql_real_escape_string($areatype), mysql_real_escape_string($area), mysql_real_escape_string($periodyear), mysql_real_escape_string($periodtype), mysql_real_escape_string($period));
     $list = $this->getResult($query, $link);
     return $list;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:qcew_data.php

示例2: getAreaList

 public function getAreaList($stfips, $areatype)
 {
     $link = getDatabaseConnection();
     $query = sprintf("select * from wid.geog " . "where stfips = '%s' and areatype = '%s' order by stfips, areatype, area", mysql_real_escape_string($stfips), mysql_real_escape_string($areatype));
     $arealist = $this->getJSONResult($query, $link);
     return $arealist;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:geog_data.php

示例3: getList

 public function getList($stfips, $areatype, $area, $seriescode, $adjusted)
 {
     $link = getDatabaseConnection();
     $query = sprintf(" SELECT s.seriesttls, s.serieslvl,  empces, format(c.empces, '###,###,###.##') as empces_fmt,\n                            c.periodyear, c.periodtype, c.period, c.stfips, c.areatype, c.area,\n                            c.adjusted, c.seriescode, c.prelim\n                             FROM wid.cescode s\n                             INNER JOIN wid.ces c ON c.stfips = s.stfips\n                             AND c.seriescode = s.seriescode\n                             WHERE c.stfips = '%s'\n                             AND c.areatype = '%s'\n                             AND c.area = '%s'\n                             AND c.seriescode = '%s'\n                             and c.adjusted = '%s'\n                             ORDER BY periodyear, periodtype, period, prelim ", mysql_real_escape_string($stfips), mysql_real_escape_string($areatype), mysql_real_escape_string($area), mysql_real_escape_string($seriescode), mysql_real_escape_string($adjusted));
     $list = $this->getResult($query, $link);
     return $list;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:ces_data.php

示例4: processData

 protected function processData()
 {
     //Alpha-num
     sanitizeUsername($this->username);
     //Verify username and password length requirements
     if (strlen($this->username) > 40) {
         throw new Exception("Username must be shorter than 40 characters");
     }
     if (strlen($this->username) > 72) {
         throw new Exception("Password must be shorter than 72 characters");
     }
     //verify username available
     $conn = getDatabaseConnection();
     $availabilityQuery = new UsernameAvailabilityQuery($conn, $this->username);
     $available = $availabilityQuery->getNumRows() == 0;
     if ($available) {
         //hash pw
         $this->password = password_hash($this->password, PASSWORD_DEFAULT);
         //add user
         $addUserQuery = new AddUserQuery($conn, $this->username, $this->password);
         $addUserQuery->query();
     } else {
         //username taken
         throw new Exception("Username taken");
     }
     return true;
 }
开发者ID:WBittner,项目名称:Warkle2,代码行数:27,代码来源:AddUserAPICall.php

示例5: getLicxocc

 public function getLicxocc($stfips, $areatype, $area, $occcode)
 {
     $link = getDatabaseConnection();
     $query = sprintf(" SELECT * from wid.licxocc x \n                             inner join wid.license l \n                             on l.stfips = x.stfips \n                             and l.licenseid = x.licenseid \n                             where l.stfips = '%s'\n                             and l.areatype = '%s'\n                             and l.area = '%s'\n                             and x.occcode = '%s' ", mysql_real_escape_string($stfips), mysql_real_escape_string($areatype), mysql_real_escape_string($area), mysql_real_escape_string($occcode));
     $list = $this->getResult($query, $link);
     return $list;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:license_data.php

示例6: getTripInfo

function getTripInfo($tripId)
{
    $rsp = new JsonResponse_TripInfo("Problem getting trip info.");
    // Connect to database
    $conn = getDatabaseConnection();
    // Prepare statement to get all waypoints with that tripid
    $statement = $conn->prepare('SELECT time, latitude, longitude
		FROM waypoints WHERE trip = :trid', array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    // Execute
    $statement->execute(array(':trid' => $tripId));
    $wps = $statement->fetchAll();
    // Loop over results and build response data.. just space-sep'd vals
    $timez = "";
    $latz = "";
    $longz = "";
    for ($i = 0, $l = count($wps); $i < $l; ++$i) {
        $timez .= $wps[$i][0] . " ";
        $latz .= $wps[$i][1] . " ";
        $longz .= $wps[$i][2] . " ";
    }
    $rsp->times = $timez;
    $rsp->lats = $latz;
    $rsp->longs = $longz;
    // Return info
    $rsp->setSuccessful();
    $rsp->respondAndExit();
}
开发者ID:lenknerd,项目名称:home-noip,代码行数:27,代码来源:commuteLogger.php

示例7: getSocCips

 public function getSocCips($soccode)
 {
     $link = getDatabaseConnection();
     $query = sprintf(" SELECT * from wid.cipcode c \n                            inner join wid.socxcip s on s.cipcode = c.cipcode\n                            where soccode = '%s'", mysql_real_escape_string($soccode));
     $list = $this->getResult($query, $link);
     return $list;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:education_data.php

示例8: getList

 public function getList($stfips, $areatype, $area, $popsource)
 {
     $link = getDatabaseConnection();
     $query = sprintf(" SELECT * from wid.populatn \n                             where stfips = '%s'\n                             and areatype = '%s'\n                             and area = '%s'\n                             and popsource = '%s' \n                             and periodyear >= '1980' ", mysql_real_escape_string($stfips), mysql_real_escape_string($areatype), mysql_real_escape_string($area), mysql_real_escape_string($popsource));
     $list = $this->getResult($query, $link);
     return $list;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:7,代码来源:population.php

示例9: getCenLabor

 public function getCenLabor($stfips, $periodyear)
 {
     $link = getDatabaseConnection();
     $sqlstring = "\n   select censtitle, format(femalelf, '#,###,###.##') as femalelf, format(malelf, '#,###,###.##') as malelf\n   from wid.censcode c, wid.cenlabor l \n   where c.censcode = l.censcode\n   and l.stfips = '%s'\n   and l.periodyear = '%s' \n   order by c.censcode";
     $query = sprintf($sqlstring, mysql_real_escape_string($stfips), mysql_real_escape_string($periodyear));
     $cenlab = $this->getJSONResult($query, $link);
     return $cenlab;
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:8,代码来源:cenlabor_data.php

示例10: processData

 protected function processData()
 {
     //add game
     $conn = getDatabaseConnection();
     $addGameQuery = new IncreaseScoreQuery($conn, $this->game, $this->player, $this->increaseAmount);
     $addGameQuery->query();
     return true;
 }
开发者ID:WBittner,项目名称:Warkle2,代码行数:8,代码来源:IncreaseScoreAPICall.php

示例11: __construct

 function __construct()
 {
     if (PRODUCTION_ENVIRONMENT) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/db.php';
     } else {
         require_once '../db.php';
     }
     $this->db = getDatabaseConnection();
 }
开发者ID:stoeffn,项目名称:abizeitung,代码行数:9,代码来源:model.php

示例12: getEmployerData

 public function getEmployerData($stfips = "41", $areatype = "01", $area = "000000", $zipcode = "", $naicscode = "000000", $sizeclass = "9", $annsalrng = "X", $search = "", $page = "1", $rows = "25", $sord = "asc", $sidx = "name")
 {
     $link = getDatabaseConnection();
     $page = max($page, 1);
     $start = $page * $rows + 1 - $rows;
     $where = sprintf(" WHERE stfips = '%s' ", mysql_real_escape_string($stfips)) . sprintf($areatype == '01' ? "" : " and areatype = '%s' and area = '%s' ", mysql_real_escape_string($areatype), mysql_real_escape_string($area)) . sprintf($naicscode == '000000' ? "" : " and primnaics like '%s' ", mysql_real_escape_string($naicscode . '%')) . sprintf($search == '' ? "" : " and name like '%s' ", mysql_real_escape_string('%' . $search . '%')) . sprintf($annsalrng == 'X' ? "" : " and annsalrng='%s'", mysql_real_escape_string($annsalrng)) . sprintf($zipcode == '' ? "" : " and zipcode='%s'", mysql_real_escape_string($zipcode)) . sprintf(($sizeclass == '9' ? "" : " and empsizrng='%s'") . " order by " . $sidx . " " . $sord . "  ", mysql_real_escape_string($sizeclass));
     $query = "select * from wid.empdb " . $where . " limit " . ($start - 1) . ", " . $rows;
     return $this->getEmployerResult($query, $where, $rows, $page, $link);
 }
开发者ID:jfpearce,项目名称:arc-tools,代码行数:9,代码来源:employer_data.php

示例13: updateUtilisateur

 private static function updateUtilisateur($utilisateur)
 {
     try {
         $bdd = getDatabaseConnection();
         $request = $bdd->prepare('UPDATE utilisateur SET nom=?, prenom=?, mail=?, username=?, password=? WHERE userId = ? ;');
         $result = $request->execute(array($utilisateur->getNom(), $utilisateur->getPrenom(), $utilisateur->getMail(), $utilisateur->getUserName(), $utilisateur->getPasswordHash(), $utilisateur->getID()));
     } catch (Exception $e) {
         die("Message: " + $e->getMEssage());
     }
 }
开发者ID:polytechlyon-isi1web,项目名称:mymovies-LafayeYoan,代码行数:10,代码来源:UtilisateurControlleur.php

示例14: processData

 protected function processData()
 {
     //roll dice
     $conn = getDatabaseConnection();
     $dice = array();
     for ($i = 0; $i < 6; $i++) {
         array_push($dice, rand(1, 6));
     }
     $rollDiceQuery = new RollDiceQuery($conn, $this->game, $dice);
     $rollDiceQuery->query();
     return true;
 }
开发者ID:WBittner,项目名称:Warkle2,代码行数:12,代码来源:RollDiceAPICall.php

示例15: processData

 protected function processData()
 {
     //add game
     $conn = getDatabaseConnection();
     $addGameQuery = new AddGameQuery($conn, $this->player1, $this->player2);
     $addGameQuery->query();
     //roll dice
     $dice = array();
     for ($i = 0; $i < 6; $i++) {
         array_push($dice, rand(1, 6));
     }
     $rollDiceQuery = new RollDiceQuery($conn, $conn->insert_id, $dice);
     $rollDiceQuery->query();
     return true;
 }
开发者ID:WBittner,项目名称:Warkle2,代码行数:15,代码来源:AddGameAPICall.php


注:本文中的getDatabaseConnection函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。