Order by in Zend Framework

Came across a nice “gotcha” using Zend _Db in Zend Framework 1 if you’re being sloppy like I was. When you’re ordering by multiple columns, always make sure to use an array.

Bad:

$select->order('col1', 'col2', 'col3');

Correct:

$select->order(array('col1', 'col2', 'col3'));

If you take a look at the order function in Zend_Db_Select, it takes a mixed parameter (string or array) and operates on that. If you’re not seeing PHP warnings, you won’t notice that the parameters ‘col2’ and ‘col3’ are being ignored.

Zend Form presentation with ZF1

Well it’s been nearly a year since I’ve done the presentation, so what better time than now to show it off? I did this presentation on Zend Form using Zend Framework 1 at mkepug.

Download my slides: Zend_Form

Also, awesome new thing I learned! If you own a Mac, and want to present with it. ALWAYS bring your display dongle.