holala
(Holala)
1
I have a field named ‘visible’,when i added this to condition,system will threw a error:
Integrity constraint violation: 1052 Column ‘visible’ in where clause is ambiguous
:
Products::model()->sTitle($_POST['title'])->with(array(
'items'=>array('condition'=>'visible=1'),
))->findAll();
if i change ‘visible’ to ‘visibled’ in the data table,and change condition ‘visible’ to ‘visibled’,it’s will be ok.
Products::model()->sTitle($_POST['title'])->with(array(
'items'=>array('condition'=>'visibled=1'),
))->findAll();
is ‘visible’ a system keyword?
i can not change data table field name,can i use ‘visiable’ on other ways?
Thank you!
Y11
(Y!!)
2
I don’t know if it’s a reserved keywords or something, but you can use any reserved keyword when you write the table name like this:
'condition' => '`visible`=1'
andy_s
(Arekandrei)
3
Probably, your products and items tables both have column "visible".
holala
(Holala)
4
yes,you are right,i looked,table product and items both have ‘visible’.
how can i solve this problem?
Please!
holala
(Holala)
5
hi,i solved this problem.
like this:
'items'=>array('condition'=>'items.visible=1'),