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


PHP DataBase::select方法代码示例

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


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

示例1: find_by_tags

 /**
  * 根据标签查找联系人
  * @param Group_Contact $group_contact
  * @return array
  */
 public function find_by_tags(Group_Contact $group_contact)
 {
     $keys = array();
     $others = array();
     //组织SQL
     foreach ($this->map as $field) {
         $name = (string) $field->name;
         $getprop = (string) $field->accessor;
         if ($getprop) {
             $value = call_user_func(array($group_contact, $getprop));
             if ($value) {
                 if (in_array($name, array('tels', 'emails', 'addresses', 'ims', 'urls', 'relations', 'events'))) {
                     if (in_array($name, array('tels', 'emails', 'ims'))) {
                         $others[$name] = $value;
                     }
                 } else {
                     $keys['gcp_contacts.' . $name] = $value;
                 }
             }
         }
     }
     if (!array_key_exists('gcp_contacts.deleted', $keys)) {
         $keys['gcp_contacts.deleted'] = 0;
     }
     if (!empty($others)) {
         $this->db->select('gcp_contacts.*')->from('gcp_contacts')->where($keys);
         $type = key($others);
         $other = $others[$type];
         $tmp = array();
         foreach ($other as $val) {
             $tmp[] = $val['value'];
         }
         $this->db->join('gcp_' . $type, 'gcp_contacts.gcid = gcp_' . $type . '.gcid', '', 'LEFT')->in('gcp_' . $type . '.value', $tmp);
         $query = $this->db->get();
     } else {
         $query = $this->db->getwhere('gcp_contacts', $keys);
     }
     $result = array();
     if ($query->count()) {
         $rows = $query->result_array(FALSE);
         foreach ($rows as $row) {
             $result[] = $row['gcid'];
         }
     }
     return $result;
 }
开发者ID:momoim,项目名称:momo-api,代码行数:51,代码来源:Group_Contact_Mapper.php

示例2: getRecentChangedPages

 /**
  * @desc Gets page ids and their categories from recentchanges and categorylins tables
  *
  * @param String $date date in format Ymd
  *
  * @return Array
  */
 private function getRecentChangedPages($date)
 {
     $betweenStart = $date . '000000';
     $betweenEnd = $date . '235959';
     $table = ['r' => 'recentchanges', 'c' => 'categorylinks'];
     $fields = ['r.rc_cur_id as id', 'c.cl_to as category'];
     $where = ['r.rc_cur_id > 0', 'rc_namespace' => NS_MAIN, 'rc_timestamp between ' . $betweenStart . ' and ' . $betweenEnd];
     $joins = ['c' => ['INNER JOIN', 'r.rc_cur_id = c.cl_from AND c.cl_to IN ("Artist", "Album", "Song")']];
     $options = ['DISTINCT', 'ORDER BY' => 'rc_timestamp desc', 'USE INDEX' => ['r' => 'rc_timestamp']];
     $result = $this->db->select($table, $fields, $where, __METHOD__, $options, $joins);
     $pages = [];
     if ($result->numRows() > 0) {
         while ($row = $result->fetchObject()) {
             $pages[] = $row;
         }
     }
     return $pages;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:LyricsWikiCrawler.php

示例3: buildContent

 /**
  * @param array $params - params for informer
  * @return string - output data
  * 
  * get materials for informer from database fnd build informer
  */
 public function buildContent($params)
 {
     if ($this->heckAllParams($params)) {
         $table = $params['materials'];
         $sql = DataBase::select($table, DB_ALL, array('order' => $params['order'], 'limit' => $params['count']));
         if (count($sql) > 0) {
             foreach ($sql as $row) {
                 $temp = $this->template;
                 foreach ($row as $k => $value) {
                     $temp = str_replace('{' . strtoupper($k) . '}', $value, $temp);
                 }
                 $this->output .= $temp;
             }
             return $this->output;
         }
     }
     return null;
 }
开发者ID:VictorSproot,项目名称:AtomXCMS-2,代码行数:24,代码来源:informers.class.php

示例4:

    ob_end_clean();
    echo '{"success":false,"message":"error: no columns given to query"}';
    exit;
}
if ($objParseColumns->success == false) {
    ob_end_clean();
    echo '{"success":false,"message":"error: no columns given to query"}';
    exit;
}
$dataBase->parseJoin($strJoin);
$dataBase->parseRestrictions($strRestrictions);
$dataBase->parseOrderBy($strOrder);
$dataBase->parseGroupBy($strGroupBy);
$dataBase->parseLimit($strLimit);
$dataBase->parseValues($strValues);
ob_end_clean();
switch ($strQuery) {
    case 'SELECT':
        echo $dataBase->select();
        break;
    case 'INSERT':
        echo $dataBase->insert();
        break;
    case 'DELETE':
        echo $dataBase->delete();
        break;
    case 'UPDATE':
        echo $dataBase->update();
        break;
}
exit;
开发者ID:browerjosiahdev,项目名称:biggest-winner,代码行数:31,代码来源:query.php

示例5: DataBase

<?php

$idCliente = filter_input(INPUT_GET, "IdCliente");
$sNombre = filter_input(INPUT_GET, "Nombre");
$cEncabezado = $sNombre;
include './dataBaseClass/connection.php';
$cDb = new DataBase();
$result = $cDb->select(array("nombre", "nacimiento", "sexo"), "Dependiente", "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">Listado de Dependientes: <b><?php 
echo $cEncabezado;
?>
</b></h1>
        </div>
        <div class="modal-body" style="margin: 20px;">
            <table class="table table-responsive table-striped">
                <thead>
                    <tr>
                        <th>Nombre</th>
                        <th>Fecha Nacimiento</th>
                        <th>Sexo</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
while ($row = mysqli_fetch_array($result)) {
    ?>
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:31,代码来源:Dependientes.php

示例6: escapeString

                return true;
            } else {
                return false;
            }
        }
    }
    public function escapeString($data)
    {
        return $this->myconn->real_escape_string($data);
    }
    public function getSql()
    {
        $val = $this->myQuery;
        $this->myQuery = array();
        return $val;
    }
}
$obj = new DataBase();
//
$obj->connect("localhost", "root", "", "comunity_service");
//$obj->update('comunity_service','login',array('username'=>'Bernard!'),array('ID',3));
//$obj->tableExists("comunity_service",'login')
// $con=new DataBase();
// $con->connect("localhost","root","","comunity_service");
//select($table, $rows = '*', $where = null, $order = null);
$obj->delete('comunity_service', 'login', 'id=6');
$obj->select('comunity_service', 'login', '*', 'ID="1"', 'id DESC');
$res = $obj->getResult();
echo "<br/>";
print_r($res);
//$obj->getSql();
开发者ID:osama9976,项目名称:git-learning,代码行数:31,代码来源:insert2.php

示例7: array

     $leftNavigation = array(new MenuList('Основное', '#/main/calendar', 'fa-dashboard', 'fa-angle-left pull-right', array(new MenuList('Календарь', '#/main/calendar', 'fa fa-calendar'), new MenuList('Калькулятор', '#/main/calculator', 'fa-calculator'))), new MenuList('Отзывы', '#/reviews', 'fa-commenting-o', 'fa-angle-left pull-right', array(new MenuList('Отзывы', '#/reviews', 'fa-list'))), new MenuList('Пользователи', '#/user/all', 'fa-user', 'fa-angle-left pull-right', array(new MenuList('Все', '#/user/all', 'fa-users'), new MenuList('Добавить', '#/user/add', 'fa-user-plus'))), new MenuList('Галерея', '#/galary/all', 'fa-th', 'fa-angle-left pull-right', array(new MenuList('Все', '#/galary/all', 'fa-photo'), new MenuList('Категории', '#/galary/categories', 'fa-list'), new MenuList('Загрузка', '#/galary/add', 'fa-upload'))));
     $_RETURN['status'] = 1;
     $_RETURN['data'] = $leftNavigation;
     echo json_encode($_RETURN);
 }
 // Список категорий и их итемов для калькуляции
 if ($_m == 'calcCategory') {
     $array = $Db->select('
         SELECT 
             c.id as catId,
             c.name as catName,
             c.image as catImage,
             i.id as iId,
             i.name as iName,
             i.description as iDesc,
             i.money as iMoney,
             i.ingredients as iIngredients,
             i.image as iImage
         
         FROM category c
         LEFT JOIN items i ON c.id = i.category
         WHERE c.visible = 1
         ORDER BY catId
         ');
     $newArr = array();
     foreach ($array as $cat) {
         if (!$newArr[$cat['catId']]) {
             $newArr[$cat['catId']] = array('id' => $cat['catId'], 'name' => $cat['catName'], 'image' => $cat['catImage'], 'items' => array());
         }
         if ($cat['iId']) {
             $newArr[$cat['catId']]['items'][$cat['iId']] = array('id' => $cat['iId'], 'name' => $cat['iName'], 'desc' => $cat['iDesc'], 'money' => $cat['iMoney'], 'ingredients' => $cat['iIngredients'], 'image' => $cat['iImage']);
开发者ID:bustEXZ,项目名称:AdministrationPanel,代码行数:31,代码来源:ajax.php

示例8: load

 /**
  * 显示完整一条node的内容
  */
 static function load($name, $nid)
 {
     $cache_id = "node_{$name}";
     $data = \Yii::$app->cache->get($cache_id);
     echo $cache_id;
     exit;
     if ($data === false) {
         //取得 content_type 指定name的所有信息
         $structs = Field::tree($name);
         $master = self::table_master($name);
         //取得主node信息,_nid表
         $row = DataBase::select($master . " as node", array('where' => array('node.id=:id' => array(':id' => $nid))));
         foreach ($structs as $field => $options) {
             $fid = (int) $options['fid'];
             //字段ID
             $mysql = $options['mysql'];
             $table = self::table_name($name, $mysql);
             $tables[$table][] = $fid;
             $fs[$fid] = $field;
             //字段
             $i++;
         }
         $rows = DataBase::find_no_nid($tables, $nid, $fs);
         $data = (object) array_merge($row, $rows);
         \Yii::$app->cache->set($cache_id, $data);
     }
     return $data;
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:31,代码来源:Node.php

示例9: header

<?php

session_start();
if (!isset($_SESSION['login_user']) || empty($_SESSION['login_user'])) {
    header("Location: /Cobranza/index.php");
    exit;
}
$idFile = filter_input(INPUT_GET, "id");
if (isset($idFile)) {
    $idFile = intval($idFile);
    if ($idFile <= 0) {
        die("El Id del Documento es incorrecto");
    } else {
        include './dataBaseClass/connection.php';
        $cDb = new DataBase();
        $result = $cDb->select(array("nombre", "type", "size", "content"), "ExpedienteElectronico", "id={$idFile}", "", "1");
        if ($result) {
            if (mysqli_num_rows($result) == 1) {
                $row = mysqli_fetch_assoc($result);
                header("Content-Type: " . $row['type']);
                header("Content-Length: " . $row['size']);
                header("Content-Disposition: inline; filename=" . $row['nombre']);
                echo $row['content'];
            } else {
                echo 'No existe un documento con ese ID';
            }
            mysqli_free_result($result);
        }
    }
} else {
    echo 'No se especifico un archivo';
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:31,代码来源:ShowFile.php

示例10: die

<?php

require_once "database.php";
if ($_GET['action'] != "new" && !$_GET['id']) {
    die("No ID provided!");
}
switch ($_GET["action"]) {
    case "new":
        $db = new DataBase();
        $result = $db->get_new_id();
        die($result['id']);
        break;
    case "get":
        $db = new DataBase();
        $result = $db->select((int) $_GET['id']);
        if ($result) {
            $json = array();
            $json['lat'] = (double) $result['latitude'];
            $json['lng'] = (double) $result['longitude'];
            // This doesn't work in my arsys hosting
            //$encoded = json_encode($json);
            $encoded = '{"lat":' . $json['lat'] . ',"lng":' . $json['lng'] . '}';
        }
        die($encoded);
        break;
    case "post":
        $db = new DataBase();
        $id = (int) $_GET['id'];
        $lat = (double) $_GET['lat'];
        $lng = (double) $_GET['lng'];
        $db->insert($id, $lat, $lng);
开发者ID:agonzalezro,项目名称:Show-me-,代码行数:31,代码来源:index.php

示例11: header

<?php

session_start();
if (!isset($_SESSION['login_user'])) {
    header("Location: /Cobranza/login.php");
}
$lEdit = FALSE;
$id = filter_input(INPUT_GET, "idPaquete");
$tipoPoliza = filter_input(INPUT_GET, "tipoPoliza");
$cobertura = filter_input(INPUT_GET, "cobertura");
if ($id != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idPaquete", "tipoPoliza", "cobertura"), "Paquete", "idPaquete = '{$id}' AND tipoPoliza = '{$tipoPoliza}' AND cobertura = '{$cobertura}'", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['cobertura'] : "Editar paquetes";
?>

<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"><?php 
echo $cEncabezado;
?>
</h1>
        </div>
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:31,代码来源:EditarPaquete.php

示例12: array

$lEdit = FALSE;
$idAgente = filter_input(INPUT_GET, "idAgente");
$nombre = filter_input(INPUT_GET, "nombre");
$clave = filter_input(INPUT_GET, "clave");
$row = array();
$row['idAgente'] = '';
$row['nombre'] = '';
$row['clave'] = '';
$row['direccion'] = '';
$row['telefono'] = '';
$row['movil'] = '';
$row['email'] = '';
if ($idAgente != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idAgente", "nombre", "clave", "direccion", "telefono", "movil", "email"), "agente", "idAgente = '{$idAgente}'", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_array($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['nombre'] : "Agregar agente";
?>

<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"><?php 
echo $cEncabezado;
?>
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:31,代码来源:EditarAgente.php

示例13: header

<?php

session_start();
if (!isset($_SESSION['login_user'])) {
    header("Location: /Cobranza/login.php");
}
$lEdit = FALSE;
$id = filter_input(INPUT_GET, "idTipo");
if ($id != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idTipo", "nombre", "descripcion"), "TipoPoliza", "", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_array($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['nombre'] : "Nuevo Tipo de Poliza";
?>

<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"><?php 
echo $cEncabezado;
?>
</h1>
        </div>
        <div class="modal-body" style="margin: 20px;">
            <form action="GuardaTipoPoliza.php" id="inputForm">
开发者ID:ggarzam88,项目名称:CobranzaWeb,代码行数:31,代码来源:EditarTipoPoliza.php


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