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


PHP DataBase::open方法代码示例

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


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

示例1: get

 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETRUTACONDUCTOR(:p_id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':p_id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->ruta = $row['ID_RUTA'];
         $this->conductor = $row['ID_CONDUCTOR'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->descripcion = $row['DESCRIPCION'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:28,代码来源:RutaConductor.php

示例2: get

 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETPLANIFICACION(:id, :nombre, :distancia, :ruta); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':distancia', $this->distancia);
     oci_bind_by_name($sent, ':ruta', $this->ruta);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:16,代码来源:Planificacion.php

示例3: getBook

 public function getBook($id)
 {
     require_once 'dbm.php';
     $data = new DataBase();
     $data->open();
     $query = "SELECT * FROM `archivo` WHERE `id_archivo` = {$id}";
     $result = mysqli_query($data->get_connect(), $query);
     $row = mysqli_fetch_array($result);
     $this->id = $row[0];
     $this->user = $row[1];
     $this->title = $row[2];
     $this->path = $row[5];
     $this->description = $row[3];
     $this->punteo = $row[6];
     $data->close();
 }
开发者ID:bjesua,项目名称:AirBook,代码行数:16,代码来源:book.php

示例4: getUserId

 function getUserId($usuario, $contrasena)
 {
     if ($usuario == "" or $contrasena == "") {
         return -1;
     }
     $datab = new DataBase();
     $datab->open();
     $connect = $datab->get_connect();
     echo $query = "SELECT id_usuario, nombre, contrasena FROM usuario WHERE nombre = '" . $usuario . "' AND contrasena = '" . $contrasena . "';";
     $result = mysqli_query($connect, $query);
     while ($row = mysqli_fetch_array($result)) {
         mysqli_close($connect);
         return $row[0];
     }
     mysqli_close($connect);
     return -1;
 }
开发者ID:bjesua,项目名称:AirBook,代码行数:17,代码来源:validacion.php

示例5: get

 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN UPDATECONDUCTOR(:id, :nombre, :cui, :direccion, :telefono, :fechanac); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':cui', $this->cui);
     oci_bind_by_name($sent, ':direccion', $this->direccion);
     oci_bind_by_name($sent, ':telefono', $this->telefono);
     oci_bind_by_name($sent, ':fechanac', $this->fechanac);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:18,代码来源:Conductor.php

示例6: getComentarios

 function getComentarios($id_archivo)
 {
     require_once 'dbm.php';
     require_once 'user.php';
     $data = new DataBase();
     $data->open();
     $comentarios = array();
     $query = "SELECT comentario.id_usuario, comentario.texto FROM comentario WHERE comentario.id_archivo = {$id_archivo} ORDER BY comentario.id_comentario DESC";
     $result = mysqli_query($data->get_connect(), $query);
     while ($row = mysqli_fetch_array($result)) {
         $elemento = new Comment();
         $usuario = new User();
         $usuario->getUser($row[0]);
         $elemento->setComentario($usuario->getNombre(), $row[1]);
         $comentarios[] = $elemento;
     }
     $data->close();
     return $comentarios;
 }
开发者ID:bjesua,项目名称:AirBook,代码行数:19,代码来源:Comment.php

示例7: Delete

 public function Delete()
 {
     require_once 'dbm.php';
     $data = new DataBase();
     $data->open();
     $query = "DELETE FROM categoria WHERE id_categoria = {$this->id}";
     $result = mysqli_query($data->get_connect(), $query);
     $data->close();
     if ($result) {
         $this->id = null;
         $this->nombre = null;
         $this->descripcion = null;
         return true;
     } else {
         return false;
     }
 }
开发者ID:bjesua,项目名称:AirBook,代码行数:17,代码来源:categoria.php

示例8: getAll

 public function getAll()
 {
     $respuesta = array();
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETALLRUTAS(:rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $elemento = new Ruta();
         $elemento->id = $row['ID_RUTA'];
         $elemento->nombre = $row['NOMBRE'];
         $respuesta[] = $elemento;
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return $respuesta;
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:27,代码来源:Ruta.php

示例9: DataBase

<?php

$username = $_POST['user'];
$password = $_POST['pass'];
$rol = 0;
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$id = 0;
$sql = "BEGIN LOGIN(:user, :pass, :rol, :id); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':user', $username);
oci_bind_by_name($sent, ':pass', $password);
oci_bind_by_name($sent, ':rol', $rol);
oci_bind_by_name($sent, ':id', $id);
oci_execute($sent);
$data->free($sent);
$data->close();
if ($rol > 0 && $id > 0) {
    session_start();
    $_SESSION['id'] = $id;
    $_SESSION['user'] = $username;
    $_SESSION['rol'] = $rol;
    header('Location: index.php');
} else {
    header('Location: loginform.php?error=1');
}
开发者ID:CEMZ,项目名称:Privado,代码行数:27,代码来源:login.php

示例10: delete

 public function delete($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN DELUSUARIO(:id); END;";
     $sent = oci_parse($data->getConn(), $sql);
     oci_bind_by_name($sent, ':id', $id);
     if (!oci_execute($sent)) {
         return false;
     }
     $data->free($sent);
     $data->close();
     return true;
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:15,代码来源:Usuario.php

示例11: update

 public function update()
 {
     if ($this->factura != "" && $this->proveedor != "" && $this->id != 0) {
         require_once 'DataBase.php';
         $data = new DataBase();
         $data->open();
         $sql = "BEGIN UPDMANTENIMIENTO(:id, :factura, :proveedor, :fecha, :monto, :descripcion, :vehiculo, :tipo); END;";
         $sent = oci_parse($data->getConn(), $sql);
         oci_bind_by_name($sent, ':id', $this->id);
         oci_bind_by_name($sent, ':factura', $this->factura);
         oci_bind_by_name($sent, ':proveedor', $this->proveedor);
         oci_bind_by_name($sent, ':fecha', $this->fecha);
         oci_bind_by_name($sent, ':monto', $this->monto);
         oci_bind_by_name($sent, ':descripcion', $this->descripcion);
         oci_bind_by_name($sent, ':vehiculo', $this->vehiculo);
         oci_bind_by_name($sent, ':tipo', $this->tipoMantenimiento);
         if (!oci_execute($sent)) {
             return false;
         }
         $data->free($sent);
         $data->close();
         return true;
     } else {
         return false;
     }
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:26,代码来源:Mantenimiento.php

示例12: get

 function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETVEHICULO(:id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->id = $row['ID_VEHICULO'];
         $this->placa = $row['PLACA'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->serie = $row['SERIE'];
         $this->motor = $row['MOTOR'];
         $this->anio = $row['ANIO'];
         $this->color = $row['COLOR'];
         $this->marca = $row['MARCA'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
开发者ID:CEMZ,项目名称:Privado,代码行数:32,代码来源:Vehiculo.php

示例13: DataBase

 function list_of_files()
 {
     // Esta funcion devolvera un arreglo de objetos para los archivos
     require_once 'dbm.php';
     $data = new DataBase();
     $userid = $this->userid;
     $query = "SELECT * FROM archivo WHERE id_usuario = {$userid}";
     $data->open();
     $result = mysqli_query($data->get_connect(), $query);
     $list_of_files = array();
     while ($row = mysqli_fetch_array($result)) {
         $elemento = new element_book($row[1], $row[2], $row[3], $row[4]);
         $elemento->setId($row[0]);
         $list_of_files[] = $elemento;
     }
     $data->close();
     return $list_of_files;
 }
开发者ID:bjesua,项目名称:AirBook,代码行数:18,代码来源:user.php


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