当前位置: 首页>>代码示例>>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;未经允许,请勿转载。