Пример #1
0
function getSeasonById($huntId)
{
    // Connect to database
    $dbInfo = initialize_db_info();
    $dbLink = db_connect($dbInfo);
    db_select($dbLink, $dbInfo);
    $findHuntByHuntIdSql = generateHuntByIdSql($huntId);
    $result = mysql_query($findHuntByHuntIdSql, $dbLink);
    if (!$result) {
        echo $findHuntByHuntIdSql;
        throw new Exception('Failed to retrieve hunt by id');
    }
    $row = mysql_fetch_assoc($result);
    $hunt = createHuntFromRow($row);
    return $hunt;
}
Пример #2
0
function getAllHunts()
{
    // connect to db
    $dbInfo = initialize_db_info();
    $dbLink = db_connect($dbInfo);
    db_select($dbLink, $dbInfo);
    $huntList = array();
    $findAllHuntsSql = generateFindAllHuntsSql();
    $result = mysql_query($findAllHuntsSql, $dbLink);
    $row = mysql_fetch_assoc($result);
    while ($row) {
        $oneHunt = createHuntFromRow($row);
        $huntList[] = $oneHunt;
        $row = mysql_fetch_assoc($result);
    }
    return $huntList;
}