PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Matías Emiliano Alvarez Durán   manejador DBA   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Ejemplo de utilización de la clase dba. Para ejecutar este script, la clase y el archivo "flat" deben de estar en el mismo directorio.
Class: manejador DBA
Manipulate flat file databases with DBA extension
Author: By
Last change:
Date: 15 years ago
Size: 1,133 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TEST - CLASS DBA</title>
</head>
<body>
    <?
       
include("dba.php"); //Incluye la clase dentro del script para poder utilizar el objeto DBA
       
       
$dba = new DBA("test.ini"); //Crea una instancia del objeto
       
       
$dba->GuardarRegistro ("clave_nueva", "valor_nuevo"); //Guarda un nuevo registro en el archivo
       
print "Valor nuevo de la clave: ".$dba->ObtenerValor ("clave_nueva"); //Obtiene el valor de un dato ingresando su clave
       
       
$array = $dba->ObtenerTodos (); //Obtiene un array con todas las claves y sus valores
       
       
print "<br><br><b>CLAVES Y VALORES</b>";
        foreach (
$array as $k => $v) //Recorre el array mostrando los valores
       
{
            print
"<br>Clave: ".$k." Valor: ".$v;
        }
       
        print
"<br><br><b>GESTORES DISPONIBLES EN SU SERVIDOR: </b><br>";
        foreach (
$dba->GestoresDisponibles() as $v)
        {
            print
"<br>$v";
        }
   
?>
</body>
</html>