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


PHP MySQLDatabase::Query方法代码示例

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


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

示例1: RefreshIngredients

 /**
  * @param bool|int $id
  */
 public function RefreshIngredients($id = false)
 {
     $result = array();
     $condition = $id ? "AND tblIngredients.id = " . (int) $id : false;
     $queryString = "SELECT * FROM tblIngredients WHERE userID = {$this->ID} {$condition}";
     $query = $this->DB->Query($queryString);
     if ($query) {
         while ($row = $query->Fetch()) {
             $ingredient = array_key_exists($row['id'], $this->Ingredients) ? $this->Ingredients[$row['id']] : new Ingredient($this, $row);
             $result[$ingredient->ID] = $ingredient;
         }
     }
     $this->Ingredients = $result;
 }
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:17,代码来源:CLASS_Session.php

示例2: privilege

<?php

require_once "../inc/initialize.php";
//checks if admin user is logged in
if (!$session->is_admin_logged_in()) {
    redirect_to('index.php');
}
$role = $_SESSION["role"];
if ($role == 4) {
    $db = new MySQLDatabase();
    $sql = "SELECT `department_name` from `department` WHERE `department_id` = '" . $_SESSION["department_id"] . "'";
    $dept = $db->Query($sql);
    $dept = $db->fetch_array($dept);
    $dept = array_shift($dept);
}
function privilege()
{
    global $role;
    switch ($role) {
        case 1:
            $msg = "Main Administrative";
            break;
        case 2:
            $msg = "Post Graduate Administrative";
            break;
        case 3:
            $msg = "Non NUC Administrative";
            break;
        case 4:
            $msg = "Departmental Administrative";
            break;
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:home.php

示例3: UpdateDatabase

 /** @return bool */
 public function UpdateDatabase()
 {
     $queryString = "\n            UPDATE tblBars\n            SET\n                `type` = " . $this->DB->Quote($this->Type) . "\n                , `title` = " . $this->DB->Quote($this->Title) . "\n                , `description` = " . $this->DB->Quote($this->Description) . "\n                , `modifyStamp` = " . microtime(true) . "\n            WHERE id = " . (int) $this->ID . " AND userID = " . (int) $this->Session->ID . "\n        ";
     return (bool) $this->DB->Query($queryString);
 }
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:6,代码来源:CLASS_Bar.php

示例4: mkdir

/*
 * All this crap switches the environment to run from the testing database and session pool.
 * Pass in /reset, and the database and sessions will be cleared, and a default user will be created.
 * 
 * Magic!
 */
$dbCredentials = 'UnitTestDBCredentials';
if (!file_exists(UNITTESTSESSIONPATH)) {
    mkdir(UNITTESTSESSIONPATH);
}
session_save_path(UNITTESTSESSIONPATH);
if (isset($Path[0]) && $Path[0] == 'reset') {
    $rm = "rm " . UNITTESTSESSIONPATH . "*";
    $rm = `{$rm}`;
    $db = new MySQLDatabase('UnitTestDBCredentials');
    $tables = $db->Query("\n\t\tSELECT table_name AS `table`\n\t\tFROM information_schema.tables\n\t\tWHERE table_schema = " . $db->Quote($UnitTestDBCredentials['name']) . ";\n\t");
    singleLog($tables);
    if ($tables) {
        $db->Query("SET FOREIGN_KEY_CHECKS = 0;");
        while ($table = $tables->Fetch()) {
            singleLog($db->Query("DROP TABLE IF EXISTS " . $table['table'] . ";"));
        }
        $db->Query("SET FOREIGN_KEY_CHECKS = 1;");
    }
    $dump = "mysqldump -u " . $DevDBCredentials['user'] . " -p" . $DevDBCredentials['pass'] . " -d " . $DevDBCredentials['name'] . " | mysql -u " . $UnitTestDBCredentials['user'] . " -p" . $UnitTestDBCredentials['pass'] . " -D" . $UnitTestDBCredentials['name'] . "";
    $dump = `{$dump}`;
    $makeUser = $db->Query("INSERT INTO tblUsers (username, password, accountType, displayName, email) VALUES ('joe', 'nohomohug', 'Standard', 'Joe Testmoore', 'joe@testmoore.com');");
    APIResponse(RESPONSE_200, "Cleared the database and sessions.");
    exit;
}
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:30,代码来源:Setup.php

示例5: SelectByWhere

 function SelectByWhere($where)
 {
     App::LoadDataClass("MySQLDatabase.php");
     $mydb = new MySQLDatabase($this->ConnString);
     $mydb->Open();
     $query = "Select * from `{$this->TableName}` {$where}";
     //App::Pr($query);
     $result = $mydb->Query($query);
     $rows = null;
     while ($row = mysql_fetch_array($result)) {
         $rows[] = $row;
     }
     $mydb->Close();
     if ($mydb->getError()) {
         $this->setError($mydb->getError());
     }
     return $rows;
 }
开发者ID:rogerwebmaster,项目名称:Philweb,代码行数:18,代码来源:BaseEntity.class.php


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