Quote:
Originally Posted by emptiness
ERROR:
Code:
Fatal error: Uncaught exception 'Zend_Db_Statement_Oracle_Exception' with message '933 ORA-00933: SQL command not properly ended SELECT "ALBUM".* FROM "ALBUM" WHERE ("ID" = 41) *SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN 1 AND 1' in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php:244 Stack trace: #0 /var/www/ZendFramework/library/Zend/Db/Statement.php(283): Zend_Db_Statement_Oracle->_execute(Array) #1 /var/www/ZendFramework/library/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array) #2 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1185): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select)) #3 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1082): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #4 /var/www/ZendFramework/library/Zend/Db/Table/Row/Abstract.php(692): Zend_Db_Table_Abstract- in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php on line 244
The Zend framework add "..*SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE..." ????
Model :
PHP Code:
class Albums extends Zend_Db_Table_Abstract
{
protected $_name = 'ALBUM';
protected $_primary = 'ID';
}
Function in my controller:
PHP Code:
function deleteAction()
{
$this->view->title = "Supprimer l'album";
$album = new Albums();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_Alpha');
$filter = new Zend_Filter_Alpha();
$ID = (int)$this->_request->getPost('ID');
$del = $filter->filter($this->_request->getPost('del'));
if (($del == 'Oui') && ($ID > 0)) {
$where = 'ID = ' . $ID;
$rows_affected = $album->delete($where);
}
} else {
$ID = (int)$this->_request->getParam('ID');
if ($ID > 0) {
// only render if we have an id and can find the album.
//$this->view->album = $album->fetchRow('ID='.$ID);
$row = $album->fetchRow($album->select()->where('ID='.$ID));
if ($this->view->album->ID > 0) {
// render template automatically
return;
}
}
}
// redirect back to the album list unless we have rendered the view
$this->_redirect('/');
}
Its the fetchrow in the ELSE is not working
|
See the work code...(sorry of my bad english, I'm from russia)
Model (Schema required)
Album.php
PHP Code:
class Album extends Zend_Db_Table
{
protected $_name = 'BIS.ALBUM';
protected $_primary = 'RECID';
protected $_sequence = false;
}
MusicController.php
PHP Code:
function deleteAction()
{
$this->view->title = "Delete Album";
$album = new Album();
if ($this->_request->isPost()){
Zend_Loader::loadClass('Zend_Filter_Alpha');
$filter = new Zend_Filter_Alpha();
$recid = (int)$this->_request->getPost('recid');
$del = $filter->filter($this->_request->getPost('del'));
if ($del == 'Yes' && $recid > 0) {
$where = 'recid=' . $recid;
$rows_affected = $album->delete($where);
}
} else {
$recid = (int)$this->_request->getParam('recid');
if ($recid > 0) {
//only render if we have an id and can find the album
$this->view->album = $album->fetchRow('recid=' .$recid);
if ($this->view->album->RECID > 0) {
// render template automatically
return;
}
}
}
//redirect back to the album list unless we have rendered the view
$this->_redirect('/admin/music/index');
}
work it! of my test example.