/** * @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; }
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); }
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; }
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); }
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); }
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; }
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; }
function findAll($appid) { $sql = 'select * from ' . $this->_table . ' where appid="' . $appid . '"'; return DB::findAll($sql); }
<?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']; ?>
<?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 = '******'; } echo json_encode($users); exit;
<?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 = '******'; $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 = '******'; $users[$i]->satker = Suggest::getSatker($users[$i]->kd_subunit); } echo json_encode($users); exit;
<?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
$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>
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 }
<?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'] . "\">×</a> | <a href=\"update.php?id=" . $tarea['id'] . "\">Editar</a><br/>"; } ?> </body> </html>
$centros = $db->findAll('centros_pokemon', $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"); $centros = $db->findAll('centros_pokemon'); //$db->pretty(); foreach ($centros as $cen) { ?> <option value="<?php echo $cen['id']; ?> "><?php echo $cen['nombre']; ?> </option> <?php } ?> </select> </div>
include "header.php"; ?> <h1>Centro Pokemon Arrecipolis</h1> <?php include "menu.php"; include "DB.php"; ?> <?php echo '<h3 align="center">Tipos</h3> <table class="table table-hover"> <tr> <td>#</td><td>Tipo</td> </tr>'; $db = new DB("root", "110992", "localhost", "centrospokemon"); $tipos = $db->findAll('catalogo_tipos'); //$db->pretty(); foreach ($tipos as $tip) { ?> <tr> <td><?php echo $tip['id']; ?> </td><td><?php echo $tip['nombre']; ?> </td> </tr> <?php } ?>
include "header.php"; ?> <h1>Centro Pokemon Arrecipolis</h1> <?php include "menu.php"; include "DB.php"; ?> <?php echo '<h3 align="center">Habilidades</h3> <table class="table table-hover"> <tr> <td>#</td> <td>Habilidad</td> </tr>'; $db = new DB("root", "110992", "localhost", "centrospokemon"); $habilidades = $db->findAll('catalogo_habilidades'); //$db->pretty(); foreach ($habilidades as $habi) { ?> <tr> <td><?php echo $habi['id']; ?> </td> <td><?php echo $habi['nombre']; ?> </td> </tr> <?php }
</div> </div> <div align="center"><img src="./images/<?php echo $ayu['imagen']; ?> "></div> <?php } ?> <label for="inputEmail3" class="col-sm-2 control-label">Evolucion</label> <select class="form-control" id="id_evolucion" name="id_evolucion"> <?php $db = new DB("root", "110992", "localhost", "centrospokemon"); $catalogos = $db->findAll('catalogo_pokemon'); //$db->pretty(); foreach ($catalogos as $cata) { ?> <option value="<?php echo $cata['id']; ?> "><?php echo $cata['especie']; ?> </option> <?php } ?> </select> </div>
function findAll_orderby_dateline() { /* 数据库函数 */ $sql = 'select * from ' . $this->_table . ' order by dateline desc'; return DB::findAll($sql); }
<td align="center" width="30%"><a href="./dar_alta4.php?id=<?php echo $poke['id']; ?> &suspendido=1"><img src="./images/activo.png" width="35px"><a></td> </tr> </table> <?php } ?> <?php $id_entrenador = $_POST['id_entrenador']; $data = array(); $data = array('id_entrenador' => $id_entrenador); $db = new DB("root", "110992", "localhost", "centrospokemon"); $catalogos = $db->findAll('vista_pokebola3', $data); ?> <!-- Button trigger modal --> <table class="table table-hover" width="100%"> <tr align="center"> <td align="center" colspan="3"><b>Pokebola</b></td> <td align="center" colspan="2"><b>Entrenador</b></td> <td align="center" colspan="4"><b>Pokemon</b></td> <td align="center" colspan="2"><b>Dar de baja</b></td> </tr> </table> <?php foreach ($catalogos as $cata) { ?> <table class="table table-hover" width="100%"> <tr>
<?php include "DB.php"; $id = 1; $data = array(); $data = array('id' => $id); $db = new DB("root", "110992", "localhost", "centrospokemon"); $regis = $db->findAll('vista_registroestatus', $data); foreach ($regis as $r) { echo $r['fecha_entrada']; $hit_points = $r['hit_points']; $estatus = $r['estatus']; $tiempo = $r['tiempo']; $desaparece = $r['desaparece_a']; function dateadd($date, $dd = 0, $mm = 0, $yy = 0, $hh = 0, $mn = 0, $ss = 0) { $date_r = getdate(strtotime($date)); $date_result = date("Y-m-d", mktime($date_r["hours"] + $hh, $date_r["minutes"] + $mn, $date_r["seconds"] + $ss, $date_r["mon"] + $mm, $date_r["mday"] + $dd, $date_r["year"] + $yy)); return $date_result; } $fecha_estimada = dateadd($r['fecha_entrada'], 8, 0, 0, 0, 0, $segundos); $hit_points = 100 - $hit_points; $minutos = $hit_points / 10 * 2.5; $segundos = $minutos * 60; if ($estatus == 1) { $segundos += $tiempo; for ($i = 0; $i >= $segundos; $i++) { if ($i == $segundos) { $suspendido = 0; } }
</option> <?php } ?> </select> </div> </div> <label for="inputEmail3" class="col-sm-2 control-label">Pokemon</label> <select class="form-control" id="id_pokemon" name="id_pokemon"> <option selected value="0">Seleccionar</option> <?php $suspendido = 1; $data = array(); $data = array('suspendido' => $suspendido); $db = new DB("root", "110992", "localhost", "centrospokemon"); $catalogos = $db->findAll('vista_pokemon', $data); //$db->pretty(); foreach ($catalogos as $cata) { ?> <option value="<?php echo $cata['id']; ?> "><?php echo $cata['especie'] . " Alias: " . $cata['alias']; ?> </option> <?php } ?> </select> </div>
<?php require '../../boot.php'; require '../../session.php'; if (!isset($session) || $session->auth == "") { Common::Error(401, 'json'); } $req = Request::all($_REQUEST); if (empty($req)) { $unit = DB::get("unit"); echo json_encode($unit); exit; } $unit = DB::findAll("unit", $req); echo json_encode($unit); exit;
<?php include "header.php"; $id = $_POST['id']; $data = array(); $data = array('id' => $id); ?> <?php $db = new DB("root", "110992", "localhost", "centrospokemon"); $enfermeras = $db->findAll('enfermeras', $data); //$db->pretty(); foreach ($enfermeras as $enfe) { ?> <form method="POST" action="saveenfermeras.php"> <input type="text" id="nombre" name="nombre" placeholder="Nombre" value="<?php echo $enfe['nombre']; ?> "> <br> <input type="text" id="apellidos" name="apellidos" placeholder="Apellidos" value="<?php echo $enfe['apellidos']; ?> "> <br> <input type="text" id="fecha_nacimiento" name="fecha_nacimiento" placeholder="Fecha de nacimiento" value="<?php echo $enfe['fecha_nacimiento']; ?> "> <br> <input type="text" id="fecha_graduacion" name="fecha_graduacion" placeholder="Fecha de graduacion" value="<?php echo $enfe['fecha_graduacion']; ?>
<div align="center"><h2>Catalogo Pokemon</h2></div> <div> <form method="POST" action="savecatalogopokemon.php" role="form"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">Especie</label> <div class="col-sm-10"> <input type="text" class="form-control" id="especie" name="especie" placeholder="Especie"> </div> </div> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">Region</label> <select class="form-control" id="region" name="region"> <option selected value="0">Seleccionar</option> <?php $db = new DB("root", "110992", "localhost", "centrospokemon"); $regiones = $db->findAll('regiones'); //$db->pretty(); foreach ($regiones as $region) { ?> <option value="<?php echo $region['id']; ?> "><?php echo $region['nombre']; ?> </option> <?php } ?> </select> </div>
<?php include "DB.php"; # json.php $db = new DB("root", "110992", "localhost", "todo"); $rows = []; $result = []; $num_rows = 0; if (isset($_GET['id'])) { $result = $db->find('tasks', ['id' => $_GET['id']]); $num_rows = $db->count(); } else { $result = $db->findAll('tasks'); $num_rows = $db->count(); } header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json; charset=utf-8'); //$db->pretty(); echo $db->toJson();
function getAll($sid) { $sql = 'select * from ' . $this->_table . ' where sid=' . $sid; return DB::findAll($sql); }
<?php require '../../boot.php'; require '../../session.php'; if (!isset($session) || $session->auth == "") { Common::Error(401, 'json'); } $req = Request::all($_REQUEST); if (empty($req)) { $satker = DB::get("satker"); echo json_encode($satker); exit; } $satker = DB::findAll("satker", $req); echo json_encode($satker); exit;
<script language="JavaScript"> function ventana(){ alert("Contraseña Incorrecta"); } </script> </head> <body> <?php include "DB.php"; $nombre = $_POST['nombre']; $password = $_POST['password']; $data = array(); $data = array('nombre' => $nombre); $db = new DB("root", "110992", "localhost", "centrospokemon"); $centros = $db->findAll('centros_pokemon', $data); foreach ($centros as $cen) { if ($cen['password'] == $password) { session_start(); $_SESSION['nombre'] = $nombre; header("Location:hoenn/index.php"); } else { ?> <script language='JavaScript'> ventana(); </script>" <?php header("Location:login.php"); } }