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


PHP Tool::consulta方法代碼示例

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


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

示例1: loginValido

 public static function loginValido($name, $pass)
 {
     $db = Tool::conectaBD();
     $sql = "SELECT * FROM Usuarios WHERE Nombre='" . $name . "'";
     $res = Tool::consulta($sql, $db);
     if (is_null($res)) {
         $aux = false;
     } else {
         if (count($res) > 0) {
             $storedpass = $res[0]['Pass'];
             $aux = $pass == $storedpass;
         } else {
             $aux = false;
         }
     }
     Tool::desconectaBD($db);
     return $aux;
 }
開發者ID:Luinux81,項目名稱:MYT-PreV,代碼行數:18,代碼來源:clase.usuario.php

示例2: session_start

<?php

include_once "../fpdf.php";
include_once "../clase.ticket.php";
include_once "../clase.compra.php";
include_once "../clase.comprador.php";
include_once "../clase.tool.php";
session_start();
if (isset($_SESSION["username"])) {
    $codigo = $_GET['code'];
    $ticket = new Ticket();
    $db = Tool::conectaBD();
    $sql = "SELECT * FROM Compras as C INNER JOIN Compradores as Co ON C.IdComprador=Co.Email WHERE Id='" . $codigo . "'";
    $res = Tool::consulta($sql, $db);
    $nombre = $res[0]['Nombre'] . " " . $res[0]['Apellidos'];
    $cantidad = $res[0]['Cantidad'];
    $ticket->nombre = $nombre;
    $ticket->codigo = $res[0]['Id'];
    $ticket->email = $res[0]['Email'];
    $ticket->creaPDF(false, $cantidad);
    Tool::desconectaBD($db);
} else {
    //ERROR: Al usar el include_once "../clase.tool.php" provoca llamada a config.php que escribe algo y da error al escribir las cabeceras. Queda atascado aqui.
    header("Location:login.php");
}
開發者ID:Luinux81,項目名稱:MYT-PreV,代碼行數:25,代碼來源:muestraTicket.php

示例3: existeTipo

 public static function existeTipo($id)
 {
     $db = Tool::conectaBD();
     if ($db) {
         $sql = "SELECT * FROM TipoTicket WHERE Id=" . $id;
         $res = Tool::consulta($sql, $db);
         $aux = mysql_affected_rows($db);
         return $aux > 0;
     } else {
         //error conectando a base de datos
         return false;
     }
     Tool::desconectaBD($db);
 }
開發者ID:Luinux81,項目名稱:MYT-PreV,代碼行數:14,代碼來源:clase.tipoTicket.php

示例4: getEvento

 public function getEvento($idTicket)
 {
     $db = Tool::conectaBD();
     if (!$db) {
         return false;
     } else {
         $sql = "SELECT IdEvento FROM TipoTicket WHERE Id='" . $idTicket . "'";
         $res = Tool::consulta($sql, $db);
         if (!is_null($res[0])) {
             return $res[0]['IdEvento'];
         } else {
             return false;
         }
     }
     Tool::desconectaBD($db);
 }
開發者ID:Luinux81,項目名稱:MYT-PreV,代碼行數:16,代碼來源:clase.compra.php

示例5: getComprador

 public function getComprador($id)
 {
     $db = Tool::conectaBD();
     if (!db) {
         //error
     } else {
         $id = Tool::limpiaCadena($id);
         $sql = "SELECT * FROM Compradores WHERE Email='" . $id . "'";
         $res = Tool::consulta($sql, $db);
         Tool::desconectaBD($db);
         if (!is_null($res[0])) {
             $this->nombre = $res[0]['Nombre'];
             $this->apellidos = $res[0]['Apellidos'];
             $this->email = $res[0]['Email'];
         } else {
             $this->nombre = "";
             $this->apellidos = "";
             $this->email = "";
         }
     }
 }
開發者ID:Luinux81,項目名稱:MYT-PreV,代碼行數:21,代碼來源:clase.comprador.php


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