yii: drop down list values and add empty selection

by prettyscripts on 2011-03-31 10:52:00 • 1 comment »

phpyii

values in drop down list called via CActiveForm::dropDownList() is be populated by passing array of value => text as parameter. eg, to select sex of a person, in the form view file: <?php echo $form->dropDownList($form, 'sex', array('1' =&g… more »

Tags: dropdown, empty, input, select, yii

yii: accessing value in select as column

by prettyscripts on 2010-11-16 11:16:06 • 3 comments »

phpsqlyii

when selecting a column as alias name, a variable (property) of the same name must be manually defined in the model. eg, if the sql is:select column_1 as alias_a from table_1 in the model file:class MyModel as CActiveRecord { public $alias… more »

Tags: alias, framework, model, select, sql, yii

symfony and doctrine: select distinct column

by prettyscripts on 2010-06-16 16:28:27 • 7 comments »

phpsymfonysql

to select distinct column values from a table, there are a few things to note to make sure only distinct rows are returned. in /path/to/lib/model/doctrine/SomeTable.class.php: public function getDistinctValue() { $q = Doctrine_Query()::create()… more »

Tags: distinct, doctrine, select, symfony