-   
- ----------------------Este es el codigo de las funciones: 
- <?php 
- define ( "odbc_sat_server", "sat_reparaciones_Odbc" ); // Host al que conectar, habitualmente es el ‘localhost’ 
- define ( "odbc_sat_USER", "" ); // Nombre del usuario con permisos para acceder; 
- define ( "odbc_sat_PASS", "" ); // Contraseña de dicho usuario 
- define ( "odbc_sat__bd", "sat-reparaciones"); // Nombre de la base de datos que se conectara 
- // Fichero con los datos de conexion a la BBDD 
- //------------------------------------------ 
- //------------------------------------------ 
-   
- class cdb 
- { 
-     private  $conexion; 
-     private $resultado; 
-      
-     public function __construct()  
-     { 
-         $conexion = 0;   
-          
-     } 
-      
-     public function __destruct() 
-     { 
-         $this->desconexion(); 
-     } 
-     public function desconexion() 
-     { 
-         if ( $this->conexion > 0 )  
-         {    
-             $conexion = 0; 
-         } 
-     } 
-     public function isconect() 
-     { 
-           return $this->conexion ; 
-     } 
-      
-     public function consulta( $query ) 
-     { 
-         $this->resultado = odbc_exec( $this->conexion, $query); 
-         if ($this->resultado ==  false) 
-         { 
-             return false; 
-         }else{ 
-             return true; 
-         }    
-                  
-     } 
-      
-     public function conexion($odbc_sat_server, $odbc_sat_USER, $odbc_sat_PASS) 
-     { 
-         $this->conexion = odbc_connect($odbc_sat_server, $odbc_sat_USER, $odbc_sat_PASS); 
-         return  $this->isconect(); 
-          
-     } 
-      
-     public function imprimir() 
-     { 
-          
-         foreach($array as $registro)  
-         { 
-             echo($registro); 
-              
-         } 
-          
-     } 
- }; 
- ?> 
- ----------------------Este es el codigo donde llamo a la funciones: 
-   
- <?php 
-     include "db.php"; 
-     $db = new cdb; 
-          
-     $odbc_sat_server = "sat_reparaciones_Odbc"; 
-     $odbc_sat_USER=  ""; 
-     $odbc_sat_PASS=  ""; 
-      
-     $db->conexion($odbc_sat_server, $odbc_sat_USER, $odbc_sat_PASS); 
-   
-     if ($db->isconect() > 0 ) 
-     { 
-         echo("conectado"); 
-         $sql = "select * from clientes"; 
-          
-         if ($db->consulta( $sql ) == true) 
-         { 
-             echo("consulta correcta"); 
-             $db->imprimir(); 
-         }else 
-         { 
-             echo("consulta incorrecta"); 
-         }    
-          
-     }else  
-     {  
-         echo("error de conexion"); 
-     }    
- ?> 
-