1

I am new to zend framework and in the process of learning. I want to know that how we can fetch whole data of a table in zend framework and display it on the screen. I saw lots of tutorials but can't understand the logic behind this.

If someone can give me small tutorial regarding this that would be very helpful.

I am using these classes

Model

Application_Model_DbTable_Form extends Zend_Db_Table_Abstract{

        protected $_name = 'register';
        protected $_primary = 'firstName';

}

class Application_Model_Sign {

    private $_dbTable;

    public function __construct() {
        $this->_dbTable = new Application_Model_DbTable_Form();
    }
}

Controller

public function outAction() {
 //action body
}

View

<html>
    <body>
        <table>
            <tr>                  
                <th>First Name</th>
                <th>Middle Name</th>
                <th>Last Name</th>
                <th>Gender</th>
                <th>Job Type</th>
            </tr>  
        </table>
    </body>
</html>

3 Answers 3

1

here i can give you sample tutorial for that you can easily understand how can we manipulate data in zend framework

http://akrabat.com/zend-framework-tutorial/

just download and install in you local.

also see

http://mishrarakesh.blogspot.in/2010/12/zend-framework-111-simple-examples.html

for better understanding.

hope this will sure help you.

Sign up to request clarification or add additional context in comments.

Comments

1

:: Model

class Default_Model_Deployment extends Zend_Db_Table_Abstract { 
    protected $_name = 'tbl_deployment';
    protected $_primary = 'id';
    public function allData(){
        $db = Zend_Db_Table::getDefaultAdapter();
        $sql = "SELECT * FROM tbl_deployment";
        $result = $db->query($sql);
        $row = $result->fetchAll(); // TO RENDER ALL DATA IN TABLE.
        return $row;
    }
}

:: Controller

class Default_DeploymentController extends Zend_Controller_Action {
  public function indexAction(){
    $model = new Default_Model_Deployment();
    $renderData = $model->allData();
    $this->view->assign(array('recDeploy'=>$renderData));
  }
} // To close class

:: View

print '<pre>';print_r($this->recDeploy);print '</pre>';die;

Comments

0

Please check this links

Hope this will help you as a begginner

The first link tells you the proper folder structure of Zend MVC

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.