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


PHP DB::findAll方法代碼示例

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


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

示例1: getAnswer_by_qid

 /**
  * @param $qid
  * @return array
  * 根據問題編號查找所有問題答案
  */
 function getAnswer_by_qid($qid)
 {
     $res = array();
     if (is_array($qid)) {
         foreach ($qid as $id) {
             $sql = 'select * from ' . $this->_answerTable . ' where qid=' . $id . ' order by dateline desc';
             $temp = DB::findAll($sql);
             if (!empty($temp)) {
                 $res[] = $temp;
             }
         }
     } else {
         $sql = 'select * from ' . $this->_answerTable . ' where qid=' . $qid . ' order by dateline desc';
         $temp = DB::findAll($sql);
         if (is_array($temp)) {
             foreach ($temp as $key => $val) {
                 $val['dateline'] = date("Y-m-d H:i:s  T", $val['dateline']);
                 $temp[$key] = $val;
             }
         }
         if (!empty($temp)) {
             $res = $temp;
         }
     }
     return $res;
 }
開發者ID:Twinkling,項目名稱:BanXing,代碼行數:31,代碼來源:qaModel.class.php

示例2: getOneMonthSalaryDetail

 function getOneMonthSalaryDetail($usercode, $Year, $Month)
 {
     //表格數據
     $sql = "SELECT filed_index\n                from " . $this->_filetable . "\n                where activestatus = '0'\n                ORDER BY sortnum";
     $fileArr = DB::findAll($sql);
     //循環數據生成SQL語句  將detail表橫表變豎表
     $sql = "";
     foreach ($fileArr as $k => $val) {
         $sql .= "SELECT \"" . $val["filed_index"] . "\" as filename," . $val["filed_index"] . " as num from " . $this->_dtailtable . " WHERE userno=\"" . $usercode . "\"\n                 and year=\"" . $Year . "\" and month=\"" . $Month . "\" union ";
     }
     $sql = rtrim(trim($sql), 'union ');
     $sql = "SELECT filed_index,chinese_name,english_name,sortnum,\n                CASE WHEN isstrong = 0 THEN '' WHEN isstrong = 1 THEN 'uk-text-bold' END AS isstrong,\n                CASE WHEN islarger = 0 THEN '' WHEN islarger = 1 THEN 'uk-text-large' END AS islarger,\n                color,detailtable.num FROM " . $this->_filetable . " left join (" . $sql . ") detailtable\n               on " . $this->_filetable . ".filed_index=detailtable.filename\n               where salary_filed.activestatus='0'\n               order by " . $this->_filetable . ".sortnum";
     return DB::findAll($sql);
 }
開發者ID:suollk,項目名稱:KLBSalary,代碼行數:14,代碼來源:salaryModel.class.php

示例3: getAll

 function getAll($sid)
 {
     $sql = 'select * from ' . $this->_table . ' where sid=' . $sid;
     $temp = DB::findAll($sql);
     if (is_array($temp)) {
         foreach ($temp as $key => $val) {
             $val['dateline'] = date("Y-m-d  T", $val['dateline']);
             $temp[$key] = $val;
         }
     } elseif (!empty($temp)) {
         $temp['dateline'] = date("Y-m-d  T", $temp['dateline']);
     }
     return $temp;
 }
開發者ID:Twinkling,項目名稱:BanXing,代碼行數:14,代碼來源:strategyModel.class.php

示例4: findOne

 public function findOne($where = array(), $field = array('*'))
 {
     //array('id'=>1,'pid'=>1)
     $fieldstr = implode(',', $field);
     if (count($where) >= 1) {
         foreach ($where as $k => $v) {
             $str .= $k . '="' . $v . '" and ';
         }
         $str = substr($str, 0, -5);
         $sql = 'select ' . $fieldstr . ' from ' . $this->_table . ' where ' . $str;
     } else {
         $sql = 'select ' . $fieldstr . ' from ' . $this->_table;
     }
     return DB::findAll($sql);
 }
開發者ID:xtzlyp,項目名稱:xtzlyp_blog,代碼行數:15,代碼來源:ContentModel.class.php

示例5: findall

 public function findall($where = array())
 {
     //array('id'=>1,'pid'=>1)
     if (count($where) >= 1) {
         foreach ($where as $k => $v) {
             $str .= $k . '="' . $v . '" and ';
         }
         $str = substr($str, 0, -5);
         $sql = 'select * from ' . $this->_table . ' where ' . $str;
     } else {
         $sql = 'select * from ' . $this->_table;
     }
     //print_r($sql);
     //die();
     return DB::findAll($sql);
 }
開發者ID:xtzlyp,項目名稱:xtzlyp_blog,代碼行數:16,代碼來源:TagModel.class.php

示例6: getAll

 function getAll($sid)
 {
     $sql = 'select * from ' . $this->_table . " where sid=" . $sid . ' order by dateline desc';
     $temp = DB::findAll($sql);
     if (is_array($temp)) {
         foreach ($temp as $key => $val) {
             $username = unserialize($val['username']);
             if (is_array($username)) {
                 $val['username'] = implode(",", $username);
             }
             $val['dateline'] = date("Y-m-d  T", $val['dateline']);
             $temp[$key] = $val;
         }
     } elseif (!empty($temp)) {
         $temp['username'] = unserialize($temp['username']);
         $temp['dateline'] = date("Y-m-d  T", $temp['dateline']);
     }
     return $temp;
 }
開發者ID:Twinkling,項目名稱:BanXing,代碼行數:19,代碼來源:partnerModel.class.php

示例7: getinquirydetail

 function getinquirydetail($inquireid)
 {
     //獲取調查問卷題目詳情
     $sql = "select * from " . $this->_inquiryquestion . " where inquireid=\"" . $inquireid . "\" order by sortnum";
     $inquiryquestionArr = DB::findAll($sql);
     $sql = "select " . $this->_inquiryoption . ".* from " . $this->_inquiryquestion . "," . $this->_inquiryoption . " where " . $this->_inquiryoption . ".questionid=" . $this->_inquiryquestion . ".id" . " and " . $this->_inquiryquestion . ".inquireid=\"" . $inquireid . "\" order by sortnum";
     $inquiryoptionArr = DB::findAll($sql);
     //將選項作為數組直接插入到問題後
     for ($j = 0; $j < count($inquiryquestionArr); $j++) {
         if (isset($newoptionArr)) {
             unset($newoptionArr);
         }
         for ($i = 0; $i < sizeof($inquiryoptionArr); $i++) {
             if ($inquiryoptionArr[$i]["questionid"] == $inquiryquestionArr[$j]["id"]) {
                 $newoptionArr[] = $inquiryoptionArr[$i];
             }
         }
         if (isset($newoptionArr)) {
             $inquiryquestionArr[$j]["data"] = $newoptionArr;
         }
     }
     return $inquiryquestionArr;
 }
開發者ID:suollk,項目名稱:KLBSalary,代碼行數:23,代碼來源:inquiryModel.class.php

示例8: findAll

 function findAll($appid)
 {
     $sql = 'select * from ' . $this->_table . ' where appid="' . $appid . '"';
     return DB::findAll($sql);
 }
開發者ID:Hikyu,項目名稱:Tam,代碼行數:5,代碼來源:userModel.class.php

示例9: array

     <?php 
echo '<h3 align="center">Entrenadores Inactivos</h3>
     <table class="table table-hover">
     <tr>
     <td>Folio</td>
     <td>Nombre</td>
     <td>Apellidos</td>
     <td>Alias</td>
     <td>Activar</td>
     </tr>';
$susp0 = $_POST['susp0'];
$data = array();
$data = array('suspendido' => $susp0);
$db = new DB("root", "110992", "localhost", "centrospokemon");
$entrenadores = $db->findAll('entrenadores', $data);
//$db->pretty();
foreach ($entrenadores as $entre) {
    ?>
     <tr>
       <td><?php 
    echo $entre['id'];
    ?>
</td>
       <td><?php 
    echo $entre['nombre'];
    ?>
</td>
       <td><?php 
    echo $entre['apellidos'];
    ?>
開發者ID:alfredo-barron,項目名稱:Pokemon-Hoenn,代碼行數:30,代碼來源:consultaentrenador.php

示例10: json_encode

<?php

require '../../boot.php';
require '../../session.php';
if (!isset($session) || $session->auth == "") {
    Common::Error(401, 'json');
}
$req = Request::all($_REQUEST);
if (empty($req)) {
    exit;
}
$users = DB::findAll("users_detail", $req);
for ($i = 0; $i < count($users); $i++) {
    $users[$i]->password = 'xxxxxxxx';
}
echo json_encode($users);
exit;
開發者ID:WisnuDiStefano,項目名稱:v4,代碼行數:17,代碼來源:detail.php

示例11: json_encode

<?php

require '../../boot.php';
require '../../session.php';
if (!isset($session) || $session->auth == "") {
    Common::Error(401, 'json');
}
$req = Request::all($_REQUEST);
if (empty($req)) {
    $users = DB::get("users");
    for ($i = 0; $i < count($users); $i++) {
        $users[$i]->password = 'xxxxxxxx';
        $users[$i]->satker = Suggest::getSatker($users[$i]->kd_subunit);
    }
    echo json_encode($users);
    exit;
}
$users = DB::findAll("users", $req);
for ($i = 0; $i < count($users); $i++) {
    $users[$i]->password = 'xxxxxxxx';
    $users[$i]->satker = Suggest::getSatker($users[$i]->kd_subunit);
}
echo json_encode($users);
exit;
開發者ID:WisnuDiStefano,項目名稱:v4,代碼行數:24,代碼來源:list.php

示例12: array

     <?php 
echo '<h3 align="center">Regeneradores Inactivos</h3>
     <table class="table table-hover">
     <tr>
     <td>Folio</td>
     <td>Slots</td>
     <td>Slots Funcionales</td>
     <td>Mantenimiento</td>
     <td>Centro Pokemon</td>
     <td>Activar</td>
     </tr>';
$susp0 = $_POST['susp0'];
$data = array();
$data = array('suspendido' => $susp0);
$db = new DB("root", "110992", "localhost", "centrospokemon");
$enfermeras = $db->findAll('vista_regeneradores', $data);
//$db->pretty();
foreach ($enfermeras as $enfe) {
    $mante = $enfe['esta_mantenimiento'];
    if ($mante == 1) {
        $imprimir = "Si";
    } else {
        $imprimir = "No";
    }
    ?>
     <tr>
      <td><?php 
    echo $enfe['id'];
    ?>
</td>
      <td><?php 
開發者ID:alfredo-barron,項目名稱:Pokemon-Hoenn,代碼行數:31,代碼來源:consultaregeneradores.php

示例13: foreach

    $centros = $db->findAll('catalogo_estatus', $data);
    foreach ($centros as $cen) {
        ?>
     <option value="<?php 
        echo $centropoke;
        ?>
" select><?php 
        echo $cen['nombre'];
        ?>
</option>
     <?php 
    }
    ?>
     <?php 
    $db = new DB("root", "110992", "localhost", "centrospokemon");
    $estatus = $db->findAll('catalogo_estatus');
    //$db->pretty();
    foreach ($estatus as $est) {
        ?>
     <option value="<?php 
        echo $poke['estatus'];
        ?>
" ><?php 
        echo $est['nombre'];
        ?>
</option>
     <?php 
    }
    ?>
     </select>
     </div>
開發者ID:alfredo-barron,項目名稱:Pokemon-Hoenn,代碼行數:31,代碼來源:updatepokemon.php

示例14: array

    echo $cata['habilidad'];
    ?>
<br>
         </div>
          <?php 
}
?>
       </td>
      <td>
     <?php 
#$id = $_GET['id'];
$id_prevolucion = $id;
$data = array();
$data = array('id_prevolucion' => $id_prevolucion);
$db = new DB("root", "110992", "localhost", "centrospokemon");
$catalogos = $db->findAll('vista_evolucion', $data);
foreach ($catalogos as $cata) {
    ?>
       <div align="center">
        <b>Evolucion: <b> 
       <b><?php 
    echo $cata['especie'];
    ?>
</b><br>
      <img src="./images/<?php 
    echo $cata['imagen'];
    ?>
">
      </div>
     <?php 
}
開發者ID:alfredo-barron,項目名稱:Pokemon-Hoenn,代碼行數:31,代碼來源:perfilpokemon.php

示例15: DB

<?php

include "DB.php";
?>
<html>
<head>
  <title>To Do List</title>
</head>
<body>
  <h1>To Do List</h1>
  <form action="save.php" method="POST">
    <input type="text" id="task" name="task" placeholder="Write a task">
    <button type="submit">Guardar</button>
  </form>
  <a href="json.php">Ver en JSON</a>
  <hr/>
<?php 
$db = new DB("root", "110992", "localhost", "todo");
$tareas = $db->findAll('tasks');
//$db->pretty();
foreach ($tareas as $tarea) {
    echo $tarea['id'] . " - " . $tarea['task'] . " <a style=\"color:red\" href=\"delete.php?id=" . $tarea['id'] . "\">&times;</a> | <a href=\"update.php?id=" . $tarea['id'] . "\">Editar</a><br/>";
}
?>
</body>
</html>
開發者ID:alfredo-barron,項目名稱:Pokemon-Hoenn,代碼行數:26,代碼來源:index.php


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