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


PHP DbConn::getConn方法代码示例

本文整理汇总了PHP中DbConn::getConn方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConn::getConn方法的具体用法?PHP DbConn::getConn怎么用?PHP DbConn::getConn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbConn的用法示例。


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

示例1: insert

 public function insert()
 {
     $pdo = DbConn::getConn();
     $pdo->exec("SET NAMES 'utf8';");
     $q = "INSERT INTO flowers(cat_id,name,description,image) VALUES (:cat_id,:name,:desc,:img)";
     $stmt = $pdo->prepare($q);
     $stmt->execute(array(":cat_id" => $this->cat_id, ":name" => $this->name, ":desc" => $this->description, ":img" => $this->image));
 }
开发者ID:aleksandar013,项目名称:flowers,代码行数:8,代码来源:Flower.php

示例2: get

 public static function get($id)
 {
     $pdo = DbConn::getConn();
     $pdo->exec("SET NAMES 'utf8';");
     $id = strip_tags(trim($id));
     $q = "SELECT * FROM " . static::$table . " WHERE " . static::$key . "=:id";
     $stmt = $pdo->prepare($q);
     $stmt->bindParam(":id", $id);
     $stmt->execute();
     $stmt->setFetchMode(PDO::FETCH_CLASS, get_called_class());
     $res = $stmt->fetch();
     return $res;
 }
开发者ID:aleksandar013,项目名称:flowers,代码行数:13,代码来源:Head.php

示例3: DbConn

<?php

/*
php test file -- connects to xampp db names sousms, user root, pw ""
*/
include "DbConn.class.php";
try {
    // connect to the database -- needed by the classes
    // that implement the behaviors
    $conn = new DbConn("localhost", "sousms", "root", "");
} catch (Exception $e) {
    // add another element
    echo "Exception: " . $conn->getDebug() . "<br />" . "\n";
}
//	echo "No Exception: " . $conn->getDebug() . "<br />". "\n";
$myConn = $conn->getConn();
$dtb = new DateTime(null, new DateTimeZone("America/Los_Angeles"));
$dte = new DateTime(null, new DateTimeZone("America/Los_Angeles"));
$dte->modify("+10 minutes");
echo "\$dte->format() " . $dte->format("Y-m-d H:i:s") . "\n";
$stmt = $myConn->prepare("insert Login values (1, md5('password'), ?, ?)");
$stmt->execute(array($dtb->format("Y-m-d H:i:s"), $dte->format("Y-m-d H:i:s")));
开发者ID:nordquip,项目名称:sousms,代码行数:22,代码来源:callStoredProc.php

示例4: DbConn

<?php

//DataFeed Team
//Author: Shaun Wolff
//Script for retrieving feed, parsing the feed, Inserting data into Table for 40 stocks.
include '../service/DbConn.class.php';
$newPDO = new DbConn();
$conn = $newPDO->getConn();
$query = $conn->prepare('CALL enterTickerDataForSymbol(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
date_default_timezone_set('America/Los_Angeles');
if (date('Hi') > 355 && date('Hi') < 1705) {
    $tradingTime = true;
} else {
    $tradingTime = false;
    echo "Trading day over.\n";
}
while (file_exists('feedControl') && $tradingTime) {
    $url = "https://basicapp.nasdaqomx.com/BasicDataXML/getBasicData?symbolsCsvList=AAPL,ADBE,ADSK,ALU,AMZN,ATVI,AXP,CAKE,CMCSA,COKE";
    $xml = simplexml_load_file($url);
    foreach ($xml->dataItems as $dataItems) {
        $symbol = $dataItems->symbol;
        $bestAskPrice = $dataItems->bestAskPrice;
        $bestAskQty = $dataItems->bestAskQty;
        $bestBidPrice = $dataItems->bestBidPrice;
        $bestBidQty = $dataItems->bestBidQty;
        $close = $dataItems->close;
        $high = $dataItems->high;
        $date = $dataItems->date;
        $tTime = $dataItems->time;
        $tMs = preg_split('/\\./', $tTime);
        $time = $tMs[0];
开发者ID:nordquip,项目名称:sousms,代码行数:31,代码来源:parseFeedInsertData.php

示例5: switch

     // add an element to the statusdesc array
     $msg->statusdesc[] = "Validation Failure: " . $e->getMessage();
     // add another element
     $msg->statusdesc[] = $myConn->getDebug();
 }
 switch ($req->behavior) {
     case "getTokenFromCredentials":
         // the constructor for Credentials can do some basic validation
         // (or throw an exception)
         $credentials = new Credentials($req->credentials->username, $req->credentials->password);
         $token = null;
         $expires = null;
         // the validate() method returns true if valid or false
         // token, expires, and msg->statusdesc are all passed
         // by reference and set inside validate()
         if (!$credentials->validate($myConn->getConn(), $token, $expires, $msg->statusdesc)) {
             // captures the reason for failure
             $msg->statuscode = 1;
             // failed
         } else {
             // success
             // set values in the return message
             $msg->success = true;
             $msg->statuscode = 0;
             $msg->statusdesc = "Login successful";
             // put the token and expires time in the return message
             $msg->retval = array("token" => $token, "expires" => $expires);
         }
         break;
     case "passwordRecovery":
         $passwordRecover = new PasswordRecover($req->passwordRecover->username, $req->passwordRecover->password);
开发者ID:nordquip,项目名称:sousms,代码行数:31,代码来源:ua.php

示例6: exit

     exit("<h1>HTTP Error 400 - Bad Request</h1>\nUnknown behavior: &quot;" . htmlentities($req->behavior) . "&quot;.");
 } else {
     $b = $req->behavior;
     $msg = new WebServiceMsg();
     $msg->behavior = $b;
     $msg->success = false;
     $msg->statuscode = 0;
     $msg->statusdesc = array();
     $msg->retval = null;
     $userID = -1;
     try {
         //Begin validation of parameters
         $myConn = new DbConn();
         //should now pull database info from config...
         //$v = new ParameterValidator($myConn->getConn()); //uncomment for production server
         $v = new ParameterValidator($myConn->getConn(), true);
         //uncomment for development
         //does requested behavior require "token" param?
         if (in_array("token", $behaviors[$b])) {
             if ($v->isValid("token", $req->token)) {
                 $userID = $v->getTranslatedValue();
             } else {
                 $msg->statuscode = 1;
             }
             $msg->statusdesc[] = $v->getMessage();
         }
         //does requested behavior require "symbol" param?
         if (in_array("symbol", $behaviors[$b])) {
             if ($v->isValid("symbol", $req->symbol)) {
                 $symID = $v->getTranslatedValue();
             } else {
开发者ID:nordquip,项目名称:sousms,代码行数:31,代码来源:trade.php


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