It uses MySQL.

The logic you need is:
PHP Code:
global $db;
$sql "select * from tablename";
$result $db->Execute($sql);

// optional:
//$num_records = $result->RecordCount();

// to loop thru the resultset:
while(!$result->EOF) {
  echo 
$result->fields['fieldname1'] . ' ' $result->fields['fieldname2'];

  
// now position to the next record so the while() loop can proceed (don't forget this part or you'll have an endless loop!):
  
$result->MoveNext();

You'll see examples of this all over the modules and classes and functions files.