Getting data from the table
Introduction
Table objects allow you several ways of retrieving data from the underlying table. The examples below continue from the animals_db database.
Details
Retrieving a single row This call returns the row data as a hash array
$browser->getRow(1);
This sql is excecuted: SELECT id,name,type,lifespan FROM tbl_animals WHERE (id = 1)
Retrieving multiple rows Get data the 3 animals in the table sorted by name starting with the 5th animal
$browser->getRows('name', 3, 5);This sql is excecuted: SELECT name,type AS ANIMAL TYPE,lifespan FROM tbl_animals
The limits/offsets are not shown below as they are set by mdb2 library and will vary from database to database.
Getting the different values in a column Getting different kinds of animals in tbl_animals eg: mammal, reptile,...
$browser->getColumnValues('type');This sql is excecuted: SELECT DISTINCT type FROM tbl_animals