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);
}
3
  • 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? Commented Jun 7, 2013 at 9:50
  • 1
    Change pay_administrator_actions.* to pay_administrator.* in your join. Commented Jun 7, 2013 at 9:54
  • Oh I see it now, woops, thank you put that as an answer and I'll accept :) Commented Jun 7, 2013 at 10:11

2 Answers 2

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.*');
Sign up to request clarification or add additional context in comments.

Comments

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.