|
|||
|
Inspired by Example 9.12. Quick creation of dates from database date values,
PHP Code:
PHP Code:
Code:
Mysqli prepare error: 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 '* FROM tournament' at line 1
#0 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Db\Statement.php(109): Zend_Db_Statement_Mysqli->_prepare('SELECT UNIX_TIM...')
#1 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Db\Adapter\Mysqli.php(330): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'SELECT UNIX_TIM...')
#2 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Db\Adapter\Abstract.php(405): Zend_Db_Adapter_Mysqli->prepare('SELECT UNIX_TIM...')
#3 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Db\Adapter\Abstract.php(617): Zend_Db_Adapter_Abstract->query('SELECT UNIX_TIM...', Array)
#4 C:\Program Files\Zend\Apache2\htdocs\netabalone\application\modules\site\controllers\IndexController.php(15): Zend_Db_Adapter_Abstract->fetchAll('SELECT UNIX_TIM...')
#5 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Controller\Action.php(502): IndexController->indexAction()
#6 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(293): Zend_Controller_Action->dispatch('indexAction')
#7 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Controller\Front.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#8 C:\Program Files\Zend\Core\ZendFramework\library\Zend\Controller\Front.php(223): Zend_Controller_Front->dispatch()
#9 C:\Program Files\Zend\Apache2\htdocs\netabalone\application\bootstrap.php(11): Zend_Controller_Front::run('../application/...')
#10 C:\Program Files\Zend\Apache2\htdocs\netabalone\web_root\index.php(2): require('C:\Program File...')
#11 {main}
Help! Last edited by legal101205 : 04-19-2008 at 06:20 PM. |
|
|||
|
Thx for your reply.
Yes, my wish is well to take all the table content and the start_date column in the timestamp format. But in this query, i was just assuming to select the start_date column. I used your correction but i got the same error. Ok i forgot to remove the * : Code:
$data = $db->fetchAll ( 'SELECT UNIX_TIMESTAMP(start_date) AS date_unix FROM tournament' ); Thx for your help. Nicolas Last edited by legal101205 : 04-19-2008 at 08:27 PM. |
|
||||
|
Hi Nicolas,
There is I should've put the * at the beginning of the query; the following should work:Code:
SELECT *, UNIX_TIMESTAMP(start_date) AS date_unix FROM tournament |
![]() |
| Thread Tools | |
| Display Modes | |
|
|