Zend Framework Database: Updating DataTag: framework, zend, zend framework, database, update, data Category: PHP Frameworkpost: 12 Apr 2008 read: 1,679 Zend Framework Database Step By Step Tutorial - Part 7: In this post, we will see action for updating data. Open your "UserController.php" within application/controller. Enter following new action:
Then, create a file named "processedit.phtml" within views/scripts/user. Enter following code:
Ok, try to update data from edit form. |
| | Give Your Opinion | Recommend |
|
1 Responses to Zend Framework Database: Updating Data:
this isa very good tutorial for beginners like me. Everything works fine so far. I have two problems that i have failed to resolve which are:
1) when i try to view the members in a list ie list.html i get the error below but the table and its headers display well:
Fatal error: Cannot use string offset as an array in C:\apache\htdocs\koba\application\views\scripts\user\list.phtml on line 25
2)on the processedit.html i get the follwing error:
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 ''first name'='', 'last_name='', 'user_name='', WHERE id=''' at line 1' in C:\apache\htdocs\koba\library\Zend\Db\Statement\Pdo.php:238 Stack trace: #0 C:\apache\htdocs\koba\library\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\apache\htdocs\koba\library\Zend\Db\Adapter\Abstract.php(405): Zend_Db_Statement->execute(Array) #2 C:\apache\htdocs\koba\library\Zend\Db\Adapter\Pdo\Abstract.php(205): Zend_Db_Adapter_Abstract->query('UPDATE user SE...', Array) #3 C:\apache\htdocs\koba\application\controllers\UserController.php(115): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE user SE...') #4 C:\apache\htdocs\koba\library\Zend\Controller\Action.php(502): UserController->processeditAction() #5 C:\apache\htdocs\koba\library\Zend in C:\apache\htdocs\koba\library\Zend\Db\Statement\Pdo.php on line 238
1) when i try to view the members in a list ie list.html i get the error below but the table and its headers display well:
Fatal error: Cannot use string offset as an array in C:\apache\htdocs\koba\application\views\scripts\user\list.phtml on line 25
2)on the processedit.html i get the follwing error:
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 ''first name'='', 'last_name='', 'user_name='', WHERE id=''' at line 1' in C:\apache\htdocs\koba\library\Zend\Db\Statement\Pdo.php:238 Stack trace: #0 C:\apache\htdocs\koba\library\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\apache\htdocs\koba\library\Zend\Db\Adapter\Abstract.php(405): Zend_Db_Statement->execute(Array) #2 C:\apache\htdocs\koba\library\Zend\Db\Adapter\Pdo\Abstract.php(205): Zend_Db_Adapter_Abstract->query('UPDATE user SE...', Array) #3 C:\apache\htdocs\koba\application\controllers\UserController.php(115): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE user SE...') #4 C:\apache\htdocs\koba\library\Zend\Controller\Action.php(502): UserController->processeditAction() #5 C:\apache\htdocs\koba\library\Zend in C:\apache\htdocs\koba\library\Zend\Db\Statement\Pdo.php on line 238
By mike on Sep 6, 2008


