Let's say that we want to retrieve the information contained in a table from the database and display it on the screen. This action will be done by a file in php and with the help of predefined objects and functions that we will see later or can be found in the section documentation.
# Connecto to DB
In this case, the object called $ db is a link to the database, whereas the object $ env to the environment values as parameters.
The code shown is very simple. In the first line the system connects to the database using a predefined method.
The following line executes a query on the database, passing as parameter the value of catalog.
# Read from DB
$db->dbQuery("SELECT name, description FROM ".$db->dbPrefix()."catalog WHERE (id = '".$env->envGet('catalog')."') LIMIT 1 ");
list($str_myname, $str_mydesc) = $db->dbFetch('row');
# Logout form DB
The next line retrieves the value obtained and delivers it as an array, assigning it to two variables. By last; The system is disconnected from the database.
# muestra los datos, ocultando descripción para pantallas pequeñas.
Here, the data is displayed, leaving to CSS the options of hiding and formatting the data.