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


PHP getDatabase函数代码示例

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


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

示例1: offline_tags

    static function offline_tags($eventId)
    {
        $tags = getDatabase()->all('SELECT tag_id,order_id FROM tags 
									WHERE order_id IN (SELECT order_id FROM cust_orders WHERE event_id=:eventid
									GROUP BY order_id HAVING COUNT(*)>0)', array('eventid' => $eventId));
        return $tags;
    }
开发者ID:Hulth,项目名称:API,代码行数:7,代码来源:tags.php

示例2: processInput

function processInput()
{
    global $myga;
    if (isset($_REQUEST["action"])) {
        switch ($_REQUEST["action"]) {
            case "createuser":
                // "users_id" INTEGER PRIMARY KEY AUTOINCREMENT,"users_username" TEXT,"users_fullname" TEXT,"users_tokendata" TEXT
                $username = $_REQUEST["username"];
                $fullname = $_REQUEST["fullname"];
                $password = sha1($_REQUEST["password"]);
                $sql = "insert into users values (NULL, '{$username}', '{$fullname}', '{$password}','0')";
                $db = getDatabase();
                $db->query($sql);
                closeDatabase($db);
                header("Location: index.php?success=created");
                break;
            case "provision":
                $username = $_REQUEST["user"];
                $tokentype = $_REQUEST["tokentype"];
                $myga->setUser($username, $tokentype);
                header("Location: index.php?success=Provisioned");
                break;
            case "auth":
                $username = $_REQUEST["user"];
                $tokencode = $_REQUEST["tokencode"];
                if ($myga->authenticateUser($username, $tokencode)) {
                    header("Location: index.php?success=Passed");
                } else {
                    header("Location: index.php?failure=wrongcode");
                }
                break;
        }
    }
}
开发者ID:kphamilton,项目名称:ga4php,代码行数:34,代码来源:input.php

示例3: getValue

function getValue()
{
    $args = func_get_args();
    $sql = array_shift($args);
    $query = getDatabase()->prepare($sql);
    $query->execute($args);
    return $query->fetchColumn();
}
开发者ID:tihig,项目名称:Tsoha-Bootstrap,代码行数:8,代码来源:connection_test.php

示例4: mysql_1_3_0

function mysql_1_3_0($sql, $params = array())
{
    try {
        getDatabase()->execute($sql, $params);
        getLogger()->info($sql);
    } catch (Exception $e) {
        getLogger()->crit($e->getMessage());
    }
}
开发者ID:gg1977,项目名称:frontend,代码行数:9,代码来源:mysql-1.3.0.php

示例5: isSalespoint

 public static function isSalespoint($user = null)
 {
     if ($user === null) {
         $user = $_SESSION['user_id'];
     }
     if (getDatabase()->execute("SELECT * FROM membership JOIN groups USING(group_id) where user_id=:u AND salespoint", array('u' => $user))) {
         return true;
     }
     return false;
 }
开发者ID:Hulth,项目名称:API,代码行数:10,代码来源:baseModule.php

示例6: get

 function get($table, $getters, $mysqli)
 {
     $params = array();
     $sql = "SELECT * FROM " . $table;
     if (!empty($getters)) {
         $params = $getters;
     }
     $params['user_id'] = $_SESSION['user_id'];
     getDatabase($sql, $params, $mysqli);
 }
开发者ID:pavlovicnemanja,项目名称:mojrokovnik,代码行数:10,代码来源:api.php

示例7: getCategories

function getCategories()
{
    $db = getDatabase();
    $state = $db->prepare("SELECT * from categories");
    $results = array();
    if ($state->execute()) {
        $results = $state->fetchAll(PDO::FETCH_ASSOC);
    }
    return $results;
}
开发者ID:ChrisTUth,项目名称:PHPSummber2015,代码行数:10,代码来源:category-functions.php

示例8: createKey

 /**
  * Creates a key
  * @param int $paramUser the user
  * @param array $paramApp app info
  * @return String the new key code
  */
 public static function createKey($paramUser, $paramApp)
 {
     if (!is_array($paramApp)) {
         throw new IllegalArgumentException("Invalid argument, array expected");
     }
     if (!array_key_exists("name", $paramApp) || !array_key_exists("desc", $paramApp) || !array_key_exists("website", $paramApp)) {
         throw new IllegalArugmentException("App info missing!");
     }
     getDatabase()->insert("orongo_auth_keys", array("key" => "", "userID" => $paramUser->getID(), "expire_ts" => "", "app_name" => $paramApp['name'], "app_desc" => $paramApp['desc'], "app_website" => $paramApp['website']));
 }
开发者ID:JacoRuit,项目名称:orongocms,代码行数:16,代码来源:OrongoAuthKey.php

示例9: checkEmail

function checkEmail($email)
{
    $db = getDatabase();
    $stmt2 = $db->prepare("Select * from users where email = :email");
    $binds = array(":email" => $email);
    if ($stmt2->execute($binds) && $stmt2->rowCount() == 1) {
        return true;
    }
    return false;
}
开发者ID:AbigailRDyer,项目名称:ADyerFinal,代码行数:10,代码来源:loginFunction.php

示例10: makeaccount

function makeaccount($email, $pass)
{
    $make = getDatabase()->prepare("insert into users set email=:email, password=:pass, created=now()");
    $binds = array(":email" => $email, ":pass" => sha1($pass));
    if ($make->execute($binds)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:ChrisTUth,项目名称:PHPSummber2015,代码行数:10,代码来源:userdate.php

示例11: sortcorps

function sortcorps($column, $sortvalue)
{
    $db = getDatabase();
    $stmt = $db->prepare("SELECT * FROM corps ORDER BY {$column} {$sortvalue}");
    $results = array();
    if ($stmt->execute() && $stmt->rowCount() > 0) {
        $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
    return $results;
}
开发者ID:dperry1,项目名称:PHPWinterClass2016,代码行数:10,代码来源:functions.php

示例12: validate

 public function validate()
 {
     $db = getDatabase();
     $q = "UPDATE temp_validation_table SET " . self::KEY_CREATED_TIME . "=0 WHERE " . self::KEY_ID . "=" . $this->data[self::KEY_ID];
     try {
         $stmt = $db->prepare($q);
         $stmt->execute();
     } catch (PDOException $ex) {
         Utils::HandlePDOException($ex);
     }
 }
开发者ID:plainbanana,项目名称:eicforum,代码行数:11,代码来源:temp_validation_code.php

示例13: sortAddress

function sortAddress($column2, $bysort)
{
    $db = getDatabase();
    $stmt = $db->prepare("SELECT * FROM address ORDER BY  {$column2} {$bysort}");
    $column2 = '%' . $column2 . '%';
    $results = array();
    if ($stmt->execute() && $stmt->rowCount() > 0) {
        $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
    return $results;
}
开发者ID:coliver2,项目名称:PHPClassWinter2016,代码行数:11,代码来源:utils.php

示例14: UpdateCategory

function UpdateCategory($value, $value2)
{
    $db = getDatabase();
    $stmt = $db->prepare("UPDATE categories SET category = :category WHERE category_id = :category_id");
    $binds = array(":category_id" => $value, ":category" => $value2);
    if ($stmt->execute($binds)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:AbigailRDyer,项目名称:PHPClassSummer2015_Home,代码行数:11,代码来源:categoryFunctions.php

示例15: sortBy

function sortBy($sort, $id)
{
    $db = getDatabase();
    $stmt = $db->prepare("SELECT * FROM address WHERE address.user_id = :user_id AND address_group_id = :address_group_id ORDER BY address_group_id DESC");
    $binds = array(":user_id" => $id, ":address_group_id" => $sort);
    $results = array();
    if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
        $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
    return $results;
}
开发者ID:AbigailRDyer,项目名称:ADyerFinal,代码行数:11,代码来源:sortFunctions.php


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