Skip to content

Instantly share code, notes, and snippets.

@cetver
Created September 17, 2013 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cetver/6591021 to your computer and use it in GitHub Desktop.
Save cetver/6591021 to your computer and use it in GitHub Desktop.
Yii PDO::FETCH_GROUP
<?php
$sth = Yii::app()->getDb()->getPdoInstance()->prepare('
SELECT
when_created,
type_id,
amount
FROM rates
WHERE employee_id = :employee_id
');
$sth->execute(array(
':employee_id' => $employee_id
));
$rows = $sth->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC);
vd($rows);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment