I wish to have the ability to choose multiple rows with one query. I'm wondering if you're able to make a move such as this?

$teamsQuery = $this->db;

foreach( $teamids as $teamid )
$teamsQuery->where('teamid', $teamid);


$teams = $teamsQuery->result();


Obviously, an ActiveRecord systems just one row inside a database within an object and attaches business and persistence logic into it. If you wish to fetch multiple rows with one query, take a look at TableDataGateway.

Within the TableDateGateway you'd possess a method findTeamsByIds which you'll pass the whole variety of IDs after which fetch individuals inside a SELECT … WHERE … IN query.

you can test this kind of function

 * get all data from the table
 * @param string $sql - mySQL query string
 * @return data as associative array
 * */
function getAll($sql) {
    $res = mysql_query($sql);

    if (!$res) {

    // Convert to array
    $ret = array();
    while ($row = mysql_fetch_assoc($res)) {
        // Add to array
        $index = count($ret);
        $ret[$index] = $row;

    return $ret;