public function index() { $arrResult = []; $bolQuery = false; $error = []; if (isset($_POST['txtDocument'])) { if (!empty($_POST['txtDocument'])) { $bolQuery = true; $objConection = new Conection(); $sql = 'SELECT usu_id ,usu_nombres ,usu_apellidos ,usu_email FROM usuario WHERE usu_id =:usu_id'; error_reporting(E_ERROR | E_WARNING | E_PARSE); $objConection->query($sql); $objConection->bind(':usu_id', $_POST['txtDocument']); $arrResult = (array) $objConection->single(); if (isset($arrResult[0]) && (string) $arrResult[0] === '') { $arrResult = []; } } else { $error[] = $this->config->errors[0]; } } $this->render('example.php', ['data' => $arrResult, 'query' => $bolQuery, 'error' => $error]); }
function __construct() { require_once "../coreapp/Conection.php"; $conection = new Conection(); $this->conn = $conection->Conectar(); return $this->conn; }
public static function getInstance() { if (!self::$_instance instanceof Conection) { self::$_instance = new self(); } return self::$_instance; }
/** * Funcion para usar el patron singleton * * @author Sergio Alejandro Valencia López <*****@*****.**> * @version 1 * @return object $inst Conection * @access public * */ public static function Instance() { if (self::$inst === null) { self::$inst = new Conection(); } return self::$inst; }
function verificar($usuario, $clave) { require '../coreapp/Conection.php'; $conection = new Conection(); $con = $conection->Conectar(); $rpta; $sql = "SELECT cod_usu FROM usuarios WHERE log_usu='{$usuario}' AND psw_usu ='{$clave}' LIMIT 0,1;"; $result = $con->query($sql); $numero = $result->num_rows; if ($numero > 0) { $rpta = TRUE; } else { $rpta = FALSE; } return $rpta; }
/** * Construtor chama a construtor da classe \Conection */ public function __construct() { try { if ($this->adapter === null) { $this->adapter = parent::__construct(); } } catch (Exception $ex) { $this->adapter = null; echo $ex; } }
public function __construct($limit, $page, $url, $from, $where = null) { parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME); $this->mysqli = parent::setConectar(); $this->_limit = $limit; $this->_page = $page; if ($page < 1) { $page = 1; } $this->_offset = ($page - 1) * $limit; $this->_url = $url; $this->_from = $from; $this->_where = $where; $this->getNrows(); }
public function update() { $value = 250; $date = date('Y-m-d h:i:s'); $intId = 141; $sql = "UPDATE meta\n SET met_fecCreacion=:date, met_valor=:value\n WHERE met_id=:id"; $objConection = new Conection(); $objConection->query($sql); $objConection->bind(':date', $date); $objConection->bind(':value', $value); $objConection->bind(':id', $intId); if ($objConection->execute() == 1) { return true; } return false; }
<?php session_start(); if (isset($_SESSION['log_usu']['autenticado']) && $_SESSION['log_usu']['autenticado']) { require "cabecera.php"; require "menu.php"; require_once "../inc/Conection.php"; //Conexion con Base de Datos $conn = new Conection(); $link = $conn->Conection(); $otorgante = $_POST["txtOtorgante"]; $sql = "SELECT indices.codIndice,CONCAT(Notario.nom_not,' ',Notario.mat_not,' ',Notario.pat_not) AS notario,indices.otorgante,indices.favorecido,indices.fecha,indices.subserie,indices.folio,indices.escritura,indices.bien \r\n\tFROM indices INNER JOIN Notario ON indices.codNotario=Notario.codNotario WHERE indices.otorgante LIKE '%{$otorgante}%'"; $result = $link->query($sql); $total = $result->num_rows; ?> <div class="container"> <div class="row"> <div class="col-md-12"> <center><h3>Lista de Índices por Otorgantes</h3></center> <?php echo "<h4>Número de Índices Encontrados: {$total} Índices</h4> "; ?> <table class="table table-striped table-bordered table-condensed" > <thead> <tr> <th>Número</th> <th>Nombre Notario</th>
<?php require_once 'conection.class.php'; if ($_POST) { $conexao = new Conection(); $conexao->useBD('localhostBD'); $conexao->useTable('listagem'); $id = $_POST['id']; $conexao->removeId($id); header('location:/mongodb'); }
function __construct() { $con = new Conection(); $this->conexion = $con->configuracion(); }
function __construct() { require_once "../coreapp/conection.php"; $this->con = new Conection(); $this->con = Conection::Conexion(); }
<?php require_once 'conection.class.php'; if ($_POST) { $conexao = new Conection(); $conexao->useBD('localhostBD'); $conexao->useTable('listagem'); $nome = $_POST['nome']; $email = $_POST['email']; $conexao->insert(array('nome' => $nome, 'email' => $email)); header('location:/mongodb'); }
<?php require_once "core/Conection.php"; $conection = new Conection(); $conn = $conection->Conectarse(); $idimagen = $_REQUEST['idimagen']; $nombre = $_REQUEST['nombre']; $ruta = $_REQUEST['ruta']; $tipo = $_REQUEST['tipo']; $taman = $_REQUEST['taman']; $imagen = $_REQUEST['image3']; $data = file_get_contents('imagenes/' . $imagen); $image = pg_escape_bytea($data); //pg_query($conn, "UPDATE imagen SET foto = '{$image}' WHERE id = 1"); pg_query($conn, "INSERT INTO imagen(nombre, rutaim, imagen, tipoim, tamima, idimag) VALUES ('{$nombre}', '{$ruta}', '{$image}', '{$tipo}', '{$taman}',{$idimagen});") or die(pg_errormessage()); pg_close($conn); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <title>Imagenes</title> </head> <body> <form action=""> idimagen:<input type="text" name="idimagen" placeholder="1"><br> nombre:<input type="text" name="nombre" placeholder="2"><br> Ruta<input type="text" name="ruta" placeholder="3"><br> Imagen<input type="file" name="image3" placeholder="4"><br> tipo<input type="text" name="tipo" placeholder="5"><br> Tamaño<input type="text" name="taman" placeholder="6"><br>
<!DOCTYPE html> <html> <head> <title>Mongodb | Inicio</title> <meta charset="utf-8"> </head> <body> <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); require_once 'conection.class.php'; $conexao = new Conection(); $conexao->useBD('localhostBD'); $conexao->useTable('listagem'); // $conexao->insert( Array('nome'=>'pedro','email'=>'*****@*****.**') ); $rows = $conexao->getAll(); function printer($arr) { echo '<pre>' . print_r($arr, 1) . '</pre>'; } ?> <form action="send.php" method="post"> <table> <tr> <td>Nome</td> <td><input type="text" name="nome"></td> </tr> <tr> <td>Email</td>
public function __construct() { parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME); $this->mysqli = parent::setConectar(); }
<?php require_once 'header.php'; require_once '../coreapp/Conection.php'; $conection = new Conection(); $mysqli = $conection->Conectar(); if (isset($_REQUEST['btnbuscar'])) { $nexo = "%"; $nombre_bien = trim($_REQUEST['nombre_bien']); $separar = explode(" ", $nombre_bien); $union = implode($nexo, $separar); $sql = "SELECT cod_sct, cod_sub, fec_doc, nom_bie, proy_id FROM escrituras1 WHERE nom_bie Like '%{$union}%'"; $res = $mysqli->query($sql); $data = $res->fetch_assoc(); $numeroRegistros = $res->num_rows; echo "Numero de Registros: " . $numeroRegistros; } ?> <form id="busqueda" name="busqueda" method="post"> <table> <thead> <tr> <td>BUSCAR POR BIEN</td> <td><input name="nombre_bien" type="text" size="80" value="<?php echo @$nombre_bien; ?> " required placeholder="Nombre del bien"/></td> <td><input name="btnbuscar" type="submit" value="Buscar" class="btn btn-info"/></td> <td></td> </tr>
<?php class Conection { public function Conectar() { require_once "config.php"; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $mysqli->set_charset("utf8"); if ($mysqli->connect_errno) { echo "Error al contenctar a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; exit; } echo $mysqli->host_info . " Test eb Conection.php"; return $mysqli; } } $conn = new Conection(); $conn->Conectar();
/** * Constructor de la clase * * @author Sergio Alejandro Valencia López <*****@*****.**> * @version 1.0 * @copyright 2014 * @return \Business * @access public */ public function __construct() { $this->_conection = Conection::Instance(); }
<?php require_once "../coreapp/Conection.php"; $conn = new Conection(); $mysqli = $conn->Conectar(); $activo = 0; $id = 1; $sql = "UPDATE campos SET activo = '{$activo}' WHERE campos.id = {$id} LIMIT 1;"; $mysqli->query($sql) or die($mysqli->error());
function __construct() { require_once "../inc/Conection.php"; $conection = new Conection(); $this->con = $conection->Conection(); }
<input type="text" name="carpeta" class="form-control" id="inputText" placeholder="Carpeta"> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <button type="reset" class="btn btn-default">Cancel</button> <button type="submit" name="btnGuardar" class="btn btn-primary">Submit</button> </div> </div> </fieldset> </form> </div> </div> </div> </body> </html> <?php require "../coreapp/conection.php"; $conection = new Conection(); $mysqli = $conection->Conexion(); if (isset($_POST['btnGuardar'])) { $archivo = $_FILES['archivo']['tmp_name']; $destino = $_SERVER['DOCUMENT_ROOT'] . "/digiarch/img/" . $_FILES['archivo']['name']; move_uploaded_file($archivo, $destino); //echo $mysqli->host_info. " aqui en addtruta"; $sql = "INSERT INTO imagenes (idimagen,ruta,directorio,idproy) VALUES (null,'{$destino}','carpeta',19)"; $mysqli->query($sql); //Insertar en base de datos }