當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataBase::query方法代碼示例

本文整理匯總了PHP中DataBase::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataBase::query方法的具體用法?PHP DataBase::query怎麽用?PHP DataBase::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataBase的用法示例。


在下文中一共展示了DataBase::query方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_siteInfo

function get_siteInfo($TcName)
{
    //    Busca en la tabla de configuraciones el valor establecido
    $query = "SELECT valor,tipo FROM Configuracion WHERE idConfiguracion = '{$TcName}'";
    include_once './dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->query($query);
    $row = mysqli_fetch_assoc($result);
    return $row["valor"];
}
開發者ID:ggarzam88,項目名稱:CobranzaWeb,代碼行數:10,代碼來源:Funciones.php

示例2: get_snapshot_category_by_cid

 /**
  * 根據時間戳和聯係人ID獲取快照分組名
  * @param int $user_id 用戶ID
  * @param int $cid 聯係人ID
  * @param int $dateline 時間戳
  * @return string
  */
 public function get_snapshot_category_by_cid($user_id, $cid, $dateline)
 {
     $sql = sprintf("SELECT category_id FROM %s WHERE uid = %d AND snapshot_id = %d AND cid = %d", $this->get_table($user_id, 'contact_classes_snapshot'), $user_id, $dateline, $cid);
     $query = $this->db->query($sql);
     if ($query->count()) {
         $result = array();
         $res = $query->result_array(FALSE);
         foreach ($res as $val) {
             $result[] = $val['category_id'];
         }
         return $result;
     }
     return array();
 }
開發者ID:momoim,項目名稱:momo-api,代碼行數:21,代碼來源:Contact_Mapper.php

示例3: _get_info_list

 /**
  * 獲取聯係信息列表
  * @param int $id 聯係人ID
  * @return array
  */
 private function _get_info_list($id, $type = 'emails')
 {
     switch ($type) {
         case 'tels':
             $row = '`type`, `value`, `pref`, `city`';
             break;
         case 'addresses':
             $row = '`type`, `country`, `postal`, `region`, `city`, `street`';
             break;
         case 'ims':
             $row = '`protocol`, `type`, `value`';
             break;
         default:
             $row = '`type`, `value`';
             break;
     }
     $query = $this->db->query("SELECT {$row} FROM `gcp_{$type}` WHERE `gcid` = '{$id}' ORDER BY `id` ASC");
     return $query->result_array(FALSE);
 }
開發者ID:momoim,項目名稱:momo-api,代碼行數:24,代碼來源:Group_Contact_Mapper.php

示例4: catch

<?php

try {
    $allowGuest = $hideDefaultView = true;
    require '../framework/inc.php';
} catch (Exception $e) {
    die('Invalid DataBase informations <a href="javascript:window.history.back();">Launch installation wizard</a>');
}
try {
    DataBase::query(file_get_contents('db-setup.sql'));
    echo 'Please remove the <strong>install</strong> folder.<br /><a href="..">Done !</a>';
    Page::setTitle('Installation Wizard');
    Page::send();
} catch (Exception $e) {
    echo '<h1>DataBase Error</h1>' . $e->message;
}
開發者ID:KasaiDot,項目名稱:SharkDev,代碼行數:16,代碼來源:db-setup.php

示例5: _findRelations

 /**
  * Find the related objects of the model
  * @param $table The name of the table of the objects
  * @param $conditions The relation conditions
  * @return array Array of objects
  */
 public function _findRelations($table, $conditions)
 {
     if (count($conditions) == 0) {
         $query = "SELECT * FROM {$table}";
     } else {
         $query = "SELECT * FROM {$table} WHERE ( {$conditions} )";
     }
     $db2 = new DataBase();
     $db2->query($query);
     $numResults = $db2->numRows();
     $results = array();
     for ($i = 0; $i < $numResults; $i++) {
         $result = $db2->fetchObject();
         $results[] = new $table($result);
     }
     return $results;
 }
開發者ID:andreums,項目名稱:framework1.5,代碼行數:23,代碼來源:ActiveRecord.class.php

示例6: header

<?php

session_start();
if (!isset($_SESSION['login_user']) || empty($_SESSION['login_user'])) {
    header("Location: /Cobranza/index.php");
    exit;
}
$idCliente = filter_input(INPUT_GET, 'id');
$nombre = filter_input(INPUT_GET, 'Nombre');
include './dataBaseClass/connection.php';
$cDb = new DataBase();
$result = $cDb->query("SELECT * FROM ExpedienteElectronico WHERE idCliente = {$idCliente}");
?>

<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button
            <h1 class="modal-title">Agregar Expediente al Cliente: <?php 
echo $nombre;
?>
</h1>
        </div>
        <div class="modal-body" style="margin: 20px;">
            <table id="tblExpedientes" class="table table-striped table-bordered" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th>Id</th>
                        <th>Nombre Archivo</th>
                        <th>Acciones</th>
                    </tr>
開發者ID:ggarzam88,項目名稱:CobranzaWeb,代碼行數:31,代碼來源:ListadoExpedientes.php

示例7: array

         if ($mail['sender'] == User::getID()) {
             $r = DataBase::update('messages', array('sender_dir' => $_GET['dir']), array('ID' => $_GET['ID'], 'sender' => User::getID()))->fetch();
         } else {
             if ($mail['recipient'] == User::getID()) {
                 $r = DataBase::update('messages', array('recipient_dir' => $_GET['dir']), array('ID' => $_GET['ID'], 'recipient' => User::getID()))->fetch();
             } else {
                 die('<h3>Mail not found</h3>');
             }
         }
     } else {
         die('<h3>That\'s not your mail !</h3>');
     }
     die('true');
     break;
 case 'unread':
     $unread = DataBase::query('SELECT COUNT(*) FROM messages WHERE opened = 0 AND recipient_dir = ' . DataBase::_secure($_GET['folder']) . ' AND recipient = ' . User::getID())->fetch()[0];
     if (strval($unread)) {
         die($unread);
     } else {
         die;
     }
     break;
 case 'send':
     // check message HTML does not comport malicious tags
     // for example with HTMLPurify PHP library
     $recipient = DataBase::get('users', array('ID'), array('fullname' => $_POST['recipient']));
     if (!count($recipient) || $recipient === false) {
         die('false');
     }
     if (DataBase::insert('messages', array('sender' => User::getID(), 'recipient' => $recipient[0]['ID'], 'subject' => htmlspecialchars($_POST['subject']), 'content' => $_POST['content'], 'sent' => array('NOW()'), 'opened' => 0, 'answerTo' => 0, 'sender_dir' => 'sent', 'recipient_dir' => 'inbox'))) {
         if (DataBase::insert('messages', array('sender' => User::getID(), 'recipient' => $recipient[0]['ID'], 'subject' => htmlspecialchars($_POST['subject']), 'content' => $_POST['content'], 'sent' => array('NOW()'), 'opened' => 0, 'answerTo' => 0, 'sender_dir' => 'sent', 'recipient_dir' => 'sent'))) {
開發者ID:KasaiDot,項目名稱:SharkDev,代碼行數:31,代碼來源:mailbox-i.php

示例8: delete

 function delete($class, $where = "")
 {
     $temp_class = new $class();
     $query = new Query($temp_class->__table__, "delete");
     if ($where != "") {
         $query->where = $where;
     }
     $db = new DataBase();
     $db->connect();
     //echo $query->build();
     $res = $db->query($query);
     return $res;
 }
開發者ID:NerdZombies,項目名稱:MateCode,代碼行數:13,代碼來源:Collection.php

示例9: findOneByPK

 public function findOneByPK()
 {
     $sql = 'SELECT * FROM ' . static::$table . ' WHERE id=:id';
     $db = new DataBase();
     return $db->query($sql, [':id' => $this->id])[0];
 }
開發者ID:TTcuXOgaJI,項目名稱:Test,代碼行數:6,代碼來源:AbstractModel.php

示例10: set_main

function set_main($photo, $i)
{
    $r = new DataBase();
    $r->query("DELETE FROM photo_main WHERE folder = '" . $photo['folder'] . "'");
    $r->query("INSERT INTO photo_main (folder, count) VALUES('" . $photo['folder'] . "', " . $i . ")");
}
開發者ID:Sywooch,項目名稱:dump,代碼行數:6,代碼來源:additem.php

示例11: COUNT

require 'framework/inc.php';
Page::setTitle('Home');
?>

<div class="row">
    <div class="col-lg-3">
        <div class="widget style1 lazur-bg">
            <div class="row">
                <div class="col-xs-4">
                    <i class="fa fa-envelope-o fa-5x"></i>
                </div>
                <div class="col-xs-8 text-right" widget="new-messages">
                    <span> New messages </span>
                    <h2 class="font-bold"><?php 
echo DataBase::query('SELECT COUNT(*) FROM messages WHERE opened = 0 AND recipient = ' . User::getID())->fetch()[0];
?>
</h2>
                </div>
            </div>
        </div>
    </div>    
    <!--<div class="col-lg-3">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <span class="label label-success pull-right">Monthly</span>
                <h5>Income</h5>
            </div>
            <div class="ibox-content">
                <h1 class="no-margins">40 886,200</h1>
                <div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div>
開發者ID:KasaiDot,項目名稱:SharkDev,代碼行數:30,代碼來源:index.php

示例12: foreach

        //Verify if account exists
        $haserror = true;
        foreach ($accounts->get() as $acc) {
            if ($_DATA['id'] == $acc['id']) {
                $haserror = false;
                $forProfileId = $acc['profile_id'];
                break;
            }
        }
        if ($haserror) {
            RestUtils::sendResponse('406', array('data' => 'accountId', 'message' => 'A conta escolhida n&atilde;o existe.'));
            exit;
        }
        if ($forProfileId != CurrentUser::getId()) {
            RestUtils::sendResponse('406', array('data' => 'accountId', 'message' => 'A conta escolhida n&atilde;o pertence ao usu&aacute;rio.'));
            exit;
        }
        //Disable STATUS
        $sql->query("UPDATE accounts SET status = 0 WHERE id = '" . $_DATA['id'] . "'");
        //Close Connection
        $sql->close();
        RestUtils::sendResponse('200');
        exit;
        break;
        /////////////////////////////////////DEFAULT
    /////////////////////////////////////DEFAULT
    default:
        RestUtils::sendResponse('405', array('message' => 'O m&eacute;todo escolhido n&atilde;o &eacute; suportado.'));
        exit;
        break;
}
開發者ID:randydom,項目名稱:meutroco.api,代碼行數:31,代碼來源:index.php

示例13: die

<?php

require 'framework/inc.php';
if (!isset($_GET['request'])) {
    die('<h3>Bad request</h3>');
}
$req = $_GET['request'];
$ans = DataBase::query('SELECT ID, fullname FROM users WHERE fullname LIKE ' . DataBase::_secure('%' . $req . '%'));
$f = array();
while ($data = $ans->fetch()) {
    $f[] = $data;
}
die(json_encode($f));
開發者ID:KasaiDot,項目名稱:SharkDev,代碼行數:13,代碼來源:mailbox-a.php

示例14: DataBase

 function get_count($id)
 {
     $db = new DataBase();
     $res = $db->query("select SUM(if(type = 'board',1,0)) as 'bcount', SUM(if(type = 'phone',1,0)) as 'pcount' from board_hits WHERE board_id = " . $id);
     return mysql_fetch_array($res);
 }
開發者ID:Sywooch,項目名稱:dump,代碼行數:6,代碼來源:main.php

示例15: DataBase

 $sql = new DataBase();
 $sql->connect();
 //Verify if exists
 $tr = $transactions->get('all', '', '', '', $ID);
 $data = $tr;
 if (count($tr) == 0) {
     RestUtils::sendResponse('406', array('data' => 'transactionId', 'message' => 'Essa transa&ccedil;&atilde;o n&atilde;o existe.'));
 }
 if ($tr[0]['profile_id'] != CurrentUser::getId()) {
     RestUtils::sendResponse('406', array('data' => 'transactionId', 'message' => 'Essa transa&ccedil;&atilde;o n&atilde;o pertence ao perfil.'));
 }
 //Remove in Ammount
 if ($data[0]['account_to'] != '') {
     $balance = $accounts->get(1, $data[0]['account_from'], 'balance');
     $balance += $data[0]['amount'];
     $sql->query("UPDATE accounts SET balance='" . $balance . "' WHERE id = '" . $data[0]['account_from'] . "'");
     $sql->query("UPDATE accounts_month_balance AS amb SET amb.balance = amb.balance + " . $data[0]['amount'] . " WHERE amb.account_id = '" . $data[0]['account_from'] . "' AND amb.year >= " . date('Y', strtotime($data[0]['date'])) . " AND amb.month >= " . date('n', strtotime($data[0]['date'])) . "");
     $balance = $accounts->get(1, $data[0]['account_to'], 'balance');
     $balance -= $data[0]['amount'];
     $sql->query("UPDATE accounts SET balance='" . $balance . "' WHERE id = '" . $data[0]['account_to'] . "'");
     $sql->query("UPDATE accounts_month_balance AS amb SET amb.balance = amb.balance - " . $data[0]['amount'] . " WHERE amb.account_id = '" . $data[0]['account_to'] . "' AND amb.year >= " . date('Y', strtotime($data[0]['date'])) . " AND amb.month >= " . date('n', strtotime($data[0]['date'])) . "");
 } else {
     $balance = $accounts->get(1, $data[0]['account_from'], 'balance');
     $balance -= $data[0]['amount'];
     $sql->query("UPDATE accounts SET balance='" . $balance . "' WHERE id = '" . $data[0]['account_from'] . "'");
     $sql->query("UPDATE accounts_month_balance AS amb SET amb.balance = amb.balance - " . $data[0]['amount'] . " WHERE amb.account_id = '" . $data[0]['account_from'] . "' AND amb.year >= " . date('Y', strtotime($data[0]['date'])) . " AND amb.month >= " . date('n', strtotime($data[0]['date'])) . "");
 }
 //Remove
 $sql->query("DELETE FROM transactions_has_tags WHERE transaction_id = '" . $ID . "'");
 $sql->query("DELETE FROM transactions WHERE id = '" . $ID . "'");
 //Close Connection
開發者ID:randydom,項目名稱:meutroco.api,代碼行數:31,代碼來源:index.php


注:本文中的DataBase::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。