0

I have this query below which I am trying to port to Zend (even further below lol). I am getting this error:

Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Specified column "admin_vfname" is not in the row'

But when I echo the $select and copy the sql into Navicat it runs fine? What is wrong with it because I can't clearly identify it?

SELECT `pay_administrator_actions`.*, `pay_administrator_actions`.* 
FROM `pay_administrator_actions` 
INNER JOIN `pay_administrator` 
ON pay_administrator.admin_uid = pay_administrator_actions.admin_uid 
WHERE (CONCAT(pay_administrator.admin_vfname, pay_administrator.admin_vlname) LIKE '%Daly%') 
LIMIT 10 

public function findActionsByName($name, $page, $rowCount) 
{
    $name = '%'.$name.'%';                
    $select = $this->select();
    $select->setIntegrityCheck(false);                
    $select->from('pay_administrator_actions');  
    $select->join('pay_administrator', 'pay_administrator.admin_uid = pay_administrator_actions.admin_uid', 'pay_administrator_actions.*');
    $select->where('CONCAT(pay_administrator.admin_vfname, pay_administrator.admin_vlname) LIKE  ?', $name);
    $select->limitPage($page, $rowCount);                
    return $this->fetchAll($select);
}
Kal
  • 2,239
  • 6
  • 36
  • 74
  • admin_vfname is in pay_administrator and in the query it is selecting * from that table so not sure why it can't find the row? – Kal Jun 07 '13 at 09:50
  • 1
    Change `pay_administrator_actions.*` to `pay_administrator.*` in your join. – Rikesh Jun 07 '13 at 09:54
  • Oh I see it now, woops, thank you put that as an answer and I'll accept :) – Kal Jun 07 '13 at 10:11

2 Answers2

1

So as per my comment you need to change pay_administrator_actions.* to pay_administrator.* in your join.

$select->join('pay_administrator', 'pay_administrator.admin_uid =    
pay_administrator_actions.admin_uid', 'pay_administrator.*');
Rikesh
  • 26,156
  • 14
  • 79
  • 87
1

I had this error, turned out I had a space after column alias. So something like:

->from('orders', ('id, count(*) AS total order ')

Hope this helps another user!

MrsPop88
  • 303
  • 4
  • 14