Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/10/2013, 07:22
Sirrohan
 
Fecha de Ingreso: julio-2010
Mensajes: 275
Antigüedad: 13 años, 10 meses
Puntos: 21
Respuesta: Clases de PHP 5.2.6 en PHP 5.4.16

Lo siento xD

Este es el contenido de la clase Cls_postgres

Código PHP:
Ver original
  1. <php
  2.  
  3. <?
  4. class Cls_postgres
  5. {
  6.     var $driver;
  7.     var $host;
  8.     var $dbname;
  9.     var $port;
  10.     var $user;
  11.     var $clave;
  12.     var $recurso;
  13.  
  14.     function __construc()
  15.     {
  16.         $this->driver= null;
  17.         $this->host=null;
  18.         $this->dbname=null;
  19.         $this->port= null;
  20.         $this->user=null;
  21.         $this->clave=null;
  22.         $this->recurso=null;
  23.     }
  24.     function obtenerValores()
  25.     {
  26.         $this->driver="driver";
  27.         $this->host="host";
  28.         $this->dbname="dbname";
  29.         $this->port="port";
  30.         $this->user="user";
  31.         $this->clave="clace";
  32.        
  33.     }
  34.     function Cls_postgres()
  35.     {
  36.         $this->obtenerValores();
  37.         $this->conexion = pg_connect("host='$this->host' dbname='$this->dbname' user='$this->user' password='$this->clave'");
  38.  
  39.     }
  40.     function obtener_objetos($recurso)
  41.     {
  42.         return pg_fetch_object($recurso);
  43.     }
  44.     function asociar($recurso)
  45.     {
  46.         return pg_fetch_assoc($recurso);
  47.     }
  48.     function obtener_array($recurso)
  49.     {
  50.         return pg_fetch_array($recurso);
  51.     }
  52.     function num_columnas($query)
  53.     {
  54.         return pg_num_rows($query);
  55.     }
  56.     function desconectar_bd()
  57.     {
  58.         pg_close();
  59.     }
  60.     function consultar($sql)
  61.     {
  62.          return pg_query($sql);
  63.     }
  64.     function obtener_todo($sql)
  65.     {
  66.         return pg_fetch_all($sql);
  67.     }      
  68.     function CambioFechaPostgres($fecha)
  69.     {
  70.         $otra_fecha= explode("/", $fecha);// en la posición 1 del arreglo se encuentra el mes en texto.. lo comparamos y cambiamos
  71.       //$buena= $otra_fecha[0]."/".$otra_fecha[1]."/".$otra_fecha[2];// volvemos a armar la fecha
  72.  
  73.         $buena= $otra_fecha[2]."-".$otra_fecha[1]."-".$otra_fecha[0];// volvemos a armar la fecha
  74.         return $buena;  
  75.     }
  76.     function PostgresFecha($fecha)
  77.     {
  78.         $otra_fecha= explode("-", $fecha);// en la posición 1 del arreglo se encuentra el mes en texto.. lo comparamos y cambiamos
  79.       //$buena= $otra_fecha[0]."/".$otra_fecha[1]."/".$otra_fecha[2];// volvemos a armar la fecha
  80.         $buena= $otra_fecha[2]."-".$otra_fecha[1]."-".$otra_fecha[0];// volvemos a armar la fecha
  81.         return $buena;  
  82.     }
  83.  
  84. }
  85.  ?>
  86.  
  87.  
  88. ?>