[eluser]Grego606[/eluser]
I am trying to add a where() condition. The targeted column is 'micro' in a table called 'songs'.
How do I read and update 'micro'?
I attempted to add 'micro' =>$label->song->micro to the "where" array.
Code:
function label($label_id)
{
$label = new Label();
$label->where(array('id' => $label_id,'micro' =>$label->song->micro));
$label->get();
...
...
I get a php error that says:
Quote:Error Number: 1054
Unknown column '0' in 'where clause'
SELECT bands.* FROM (`bands`) LEFT JOIN `bands_labels` ON bands.id = band_id LEFT JOIN `labels` ON labels.id = label_id WHERE `0` IS NULL AND labels.id = 1 ORDER BY `sort`
The Datamapper file:
Code:
class Label extends DataMapper {
var $has_many = array('band' => 'bands', 'song' => 'songs', 'file' => 'files');
function Label($condition = array())
{
parent::DataMapper($condition);
}
}