Hi all I keep getting a Unknown column ‘Array’ in ‘where clause’ with $receiverName, when I debug $receiver I get this ouput
array(
(int) 0 => array(
'Invoice' => array(
'receiver_id' => '3',
'id' => '1'
),
'FieldsInvoice' => array(
(int) 0 => array(
'id' => '1',
'field_id' => '9',
'invoice_id' => '1',
'entered_value' => '1000.00'
)
)
),
(int) 1 => array(
'Invoice' => array(
'receiver_id' => '4',
'id' => '2'
),
'FieldsInvoice' => array(
(int) 0 => array(
'id' => '2',
'field_id' => '9',
'invoice_id' => '2',
'entered_value' => '2000.00'
)
)
),
(int) 2 => array(
'Invoice' => array(
'receiver_id' => '7',
'id' => '3'
),
'FieldsInvoice' => array()
),
(int) 3 => array(
'Invoice' => array(
'receiver_id' => '8',
'id' => '4'
),
'FieldsInvoice' => array()
),
//returns receiver_id from the invoices table where sender_id=current user account
$receiver=$this->Invoice->find('all',array(
'fields'=>('receiver_id'),'conditions'=>array(
'sender_id'=>$accounts2)));
//returns company_name from the accounts tables where receiver_id=account.id
what I’m trying to do is grab receiver_id from the array, then compare that with account.id then print company_name but its throwing an issue with the where statement in my $receiverName find
$receiverName=$this->Account->find('all',array(
'fields'=>('company_name'),'conditions'=>array(
'id'=>$receiver)));
That’s because you are passing array, change you $receiver line to following