本文整理汇总了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;
}
示例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;
}
}
}
示例3: getValue
function getValue()
{
$args = func_get_args();
$sql = array_shift($args);
$query = getDatabase()->prepare($sql);
$query->execute($args);
return $query->fetchColumn();
}
示例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());
}
}
示例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;
}
示例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);
}
示例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;
}
示例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']));
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}