Base example
Previous  Next

The below minimal example shows how to correctly access a Gladius database to retrieve the content of a table and print it using the standard PHP response output.

<?php
            // include the database engine PHP code
            include 'gladius/gladius.php';
            
            // creates the Gladius instance
            $G = new Gladius();

            // select the existing database
            $G->SelectDB('full_path_to_db/database_name/') or die($G->errstr);
            
            // execute the SQL statement
            $rs = $G->Query('SELECT * FROM mytable');
            
            // retrieve the array of rows
            $data = $rs->GetArray();
            
            // print the raw arrays
            print_r($data);
?>