|
|||
|
I hv created the Table Class and saved the table class under library->Tables(new folder)->user.php.
class User extends Zend_Db_Table_Abstract { protected $_schema = 'zfwork';// DB name protected $_name = 'user';// Table name protected $_primary = 'ID';// primary key setting. } Here do i need to give the other fields(email,phone) also? or not required? ----------------------- And added the below code to do autoloading of required class. require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); IN the bootstrap file(index.php). Then the below statment is required for table operation? "require_once 'Zend/Db/Table/Abstract.php';" ----------------------- While using the below code in the controller page (UserController.php) in the listAction() function, i am not getting the output. Can you plz tell me where is the error and whats the problem? Because its confusing. $table = new Tables_User(); $users = $table->find(2); print_r($users); ----------------------- One more thing is, for DB connection i am using the following code and connected successfully. My question is, if i hv the DB connection then why should i use a separate "Table Classes" like above. And plz tell me the importance of this also. $options = array('host'=> 'localhost', 'username'=> 'developer', 'password'=> 'success', 'dbname'=> 'test' ); $db = Zend_Db::factory('Pdo_Mysql', $options); ----------------------- Please explain the above DB & Table functionality questions with some example. -Mugesh |
|
|||
|
Quote:
PHP Code:
PHP Code:
|
|
|||
|
Read up on Zend_Db_Table. It is not necessary to use this component, but I like using it.
Zend_Db_Table |
![]() |
| Thread Tools | |
| Display Modes | |
|
|