Thursday, January 27, 2011

getting an error Unknown column 'State.name' in 'order clause'

hi bakers,
good morning to all but it is not going good for me,
since morning i m trying to resolve one error

"Unknown column 'State.name' in 'order clause'"

but i m not getting where exactly i m wrong,
can anyone suggest me the solution on it,

a query is coming out in error is as fallows

Query: SELECT `State`.`id`, `State`.`title` FROM `states` AS `State`
WHERE 1 = 1 ORDER BY `State`.`name` ASC

and my controller is doing this

function add() {

$states = $this->State->find('list');
//print_r($states);exit;
$cities = $this->City->find('all',
array('conditions'=>array($states)));
$this->set(compact('states', 'cities'));

}


and my model is as fallows


<?php
class State extends AppModel {
var $name = 'State';
var $order = "State.name ASC";
}
?>

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: