$sql = "select * from users";
$statement1 = $db->query($sql);
$result = $statement1->execute()->current();
The above code returns the data from a single user.
How to get the data from all users?
Please help.
As @tasmaniski mentioned in the comment, you need to remove the current(), and $result becomes a "resulSet", which is readable by a foreach. Try this:
$sql = "select * from users";
$statement1 = $db->query($sql);
$results = $statement1->execute();
foreach($results as $result){
var_dump($result);
}
More documentation here: http://framework.zend.com/manual/current/en/modules/zend.db.result-set.html