<html>
 
 
    <head>
 
        <title>DBI DEMO</title>
 
        <?php
 
              
 
              // Configuration File
 
              if( ! $GLOBALS['lib_config_read'] ) {
 
                  include('lib_config.class');
 
              }
 
              
 
              /* Database Interface */
 
              if( ! $GLOBALS['lib_dbi_read'] ) {
 
                  include('lib_dbi.class');
 
              }
 
              
 
              $config = new CONFIG;
 
              
 
              $dbh = new DBI;
 
 
        ?>
 
    </head>
 
 
    <body>
 
        
 
    <?php
 
        /* Edit Config-File 'lib_config.class' for dbname/dbuser/dbpwd */
 
        $dbh->connect();
 
 
        $dbexec = $dbh->prepare("SELECT * FROM table");
 
        if ( $dbexec->execute() && $dbexec->rows() > 0 ) {
 
            while ( $row = $dbexec->fetchrow_hashref() ) {
 
                echo "Firstname: {$row->FIRSTNAME} Lastname: {$row->LASTNAME}";    
 
            }
 
        }
 
        else {
 
            echo "Failure";
 
        }
 
        
 
        /* More Obj Methods 
 
            $dbh->pconnect();
 
            $dbexec->insert_id();
 
            $dbexec->finish();
 
            $dbexec->fetchrow_array();
 
            $dbexec->fetchrow_hash();
 
        */
 
    ?>
 
    
 
    </body>
 
 
</html>
 
 |