• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getDatabaseConnection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: doLogin

function doLogin($user_id, $user_pass)
{
    $connect = getDatabaseConnection();
    // See if the user is in the database
    $query = sprintf("SELECT * from user_access where lower(user_id) = lower('%s') and user_pass = '%s'", mysql_real_escape_string($user_id), mysql_real_escape_string($user_pass));
    $result = mysql_query($query);
    $num = mysql_num_rows($result);
    if ($num > 0) {
        // Generate a GUID
        $result = mysql_query("select uuid() as unique_id");
        $retVal = mysql_result($result, 0, "unique_id");
        mysql_query("update user_access set user_session_uuid='" . $retVal . "', last_access_datetime=utc_timestamp()");
    } else {
        $retVal = null;
    }
    closeDatabaseConnection($connect);
    return $retVal;
}
开发者ID:bceverly,项目名称:CanBobDoIt,代码行数:18,代码来源:user.php


示例17: processData

 protected function processData()
 {
     //Alpha-num
     sanitizeUsername($this->username);
     //Verify username and password length requirements
     if (strlen($this->username) > 40) {
         throw new Exception("Username invalid");
     }
     if (strlen($this->username) > 72) {
         throw new Exception("Password incorrect");
     }
     //verify password
     $conn = getDatabaseConnection();
     $storedPassQuery = new PasswordQuery($conn, $this->username);
     $storedPassHash = $storedPassQuery->getPassword();
     $valid = password_verify($this->password, $storedPassHash);
     return $valid;
 }
开发者ID:WBittner,项目名称:Warkle2,代码行数:18,代码来源:LogInAPICall.php


示例18: __construct

 public function __construct($target, $singularity = false)
 {
     if (!$singularity) {
         trigger_error('STOP! Use: $db = databaseMachine::getDatabaseMachine();', E_USER_NOTICE);
         exit(1);
     }
     $this->_target = $target;
     if (!isset($this->_dbLink)) {
         $this->_dbLink = getDatabaseConnection();
     }
     if ($this->_dbLink) {
         if (!@mysql_select_db($this->_target, $this->_dbLink)) {
             trigger_error('Could not select database target: ' . $this->_target, E_USER_NOTICE);
             @mysql_close($this->_dbLink);
             $this->_dbLink = null;
         }
     } else {
         trigger_error('Could not connect to database server.', E_USER_NOTICE);
     }
 }
开发者ID:jmullan,项目名称:gallery2-triage,代码行数:20,代码来源:databaseMachine.class.php


示例19: hasValidSession

function hasValidSession()
{
    // See if username and password are set in session variables
    if ($_SESSION["uname"] == null || $_SESSION["phash"] == null) {
        return false;
    }
    // Try connecting to database
    $conn = getDatabaseConnection();
    // Prepare statement to check for users with that name
    $statement = $conn->prepare('SELECT hashedpw
		FROM users WHERE username = :username', array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    // Execute
    $statement->execute(array(':username' => $_SESSION["uname"]));
    $wps = $statement->fetchAll();
    // If no users available, can't be a valid session...
    if (count($wps) == 0) {
        return false;
    }
    // Get hashed password (could check that only one user exists, but okay)
    $phash = $wps[0][0];
    // If equal to session var then fine
    return $phash == $_SESSION["phash"];
}
开发者ID:lenknerd,项目名称:home-noip,代码行数:23,代码来源:authentication.php


示例20: session_start

 * A HTML/PHP script file that acts as the account
 * portal authorized by logging into the MySQL
 * accounts database table used by the SWGEMU 
 * Core3 server for user management within MySQL.
 * 
 * Refer to Register.php for DB structure.
 * 
 * fin
 */
require_once 'includes/Conn.php';
session_start();
//Is this the indexed session from account_id?
if (!isset($_SESSION["account_id"])) {
    header('Location: Login.php');
} else {
    $con = getDatabaseConnection();
    $account_id = $_SESSION["account_id"];
    //Match query to account_id row
    if ($stmt = $con->prepare("SELECT username FROM accounts WHERE account_id=?")) {
        $stmt->bind_param("i", $account_id);
        $stmt->execute();
        $result = $stmt->get_result();
        if ($result->num_rows == 1) {
            $row = $result->fetch_assoc();
        } else {
            session_unset();
            header("Location: Login.php");
            exit(0);
        }
    }
}
开发者ID:Gargash,项目名称:SWGEMULogin,代码行数:31,代码来源:Account.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getDate函数代码示例发布时间:2022-05-15
下一篇:
PHP getDatabase函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap