I am getting some data from a database table tableA and need to return the 'name' column inside a div tag.
$divtag1 = '<div style="color:#1569C7; font-weight:bold">';
$select = $this->select()
->from(array('ta' => 'tableA'),
array('ta.id',
'name' => new Zend_Db_Expr("concat($divtag1 . ta.name . '</div>')"),
'date' => new Zend_Db_Expr("date(ta.date)")
));
$result = $this->getAdapter()->fetchAll($select);
I am getting an error :
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
. ta.name . '
') AS `name`, da'
The problem is that the concat() function is interpreting the quotes inside the $divtag1 for itself and I do not want that.
Can someone help me in getting this right?
Thanks for your help.
Try