![]() |
|
|||
|
I show my code:
[PHP]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; } } [/PHP] 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 Any ideas? |
|
|||
|
try
Code:
public function countusers() {
$select = $this->select();
$select->from($this->_name,'COUNT(*) AS num');
return $this->fetchRow($select)->num;
}
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |