I show my code:
PHP Code:
class users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
public function select() {
return $this->getAdapter()->select();
}
public function countusers() {
$select = $this->select();
$select->from($this->_name,'COUNT(id) AS num');
$row=$this->fetchRow($select);
return $row->num;
}
}
but then, i want countusers, I get:
Code:
Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message '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 '' at line 10' in /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Statement/Pdo.php:227 Stack trace: #0 /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Statement.php(279): Zend_Db_Statement_Pdo->_execute(Array) #1 /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Adapter/Abstract.php(396): Zend_Db_Statement->execute(Array) #2 /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Select), Array) #3 /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Table/Abstract.php(1104): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select)) #4 /home/banners/domains/vipuff.com/public_html/library/Zend/Db/Table/Abstract.php(1011): Zend_Db_Tab in /***/***/public_html/library/Zend/Db/Statement/Pdo.php on line 227
if i write echo $select in true place, and see query, who work in phpmyadmint, but no work in users->countusers();.
Any ideas?