How to fetch last inserted id, fetch all record and fetch a single record?
Answer Posted / Sudhir Kumar
In Zend Framework, you can use the Zend_Db_Adapter to interact with the database. Here's how to fetch data:n1. Last Inserted ID: `$lastId = $this->getAdapter()->lastInsertId($tableName);`n2. Fetch All Records: `$resultSet = $this->getAdapter()->fetchAll('SELECT * FROM ' . $tableName);`n3. Fetch a Single Record: `$row = $this->getAdapter()->fetchRow('SELECT * FROM ' . $tableName . ' WHERE id=' . $id);`
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers