function ff_select($sql, $error=FF_DIE)
{
    $database = JFactory::getDBO();
    $database->setQuery($sql);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        $dienow = $error==FF_DIE;
        $error = $database->stderr();
        $rows = array();
        if ($dienow) ff_die($error);
    } else
        $error = null;
    return $rows;
} // ff_select