public function getTodoItem($user_id) { $query = "SELECT * FROM todos WHERE user_id=?"; $params = array($user_id); $this->db->query($query, $params); $result = $this->db->fetchAll(); return $result; }
/** * * @return \Todo\Models\User[] */ public function getAll() { $query = "SELECT user_id,username,password FROM users"; $this->db->query($query); $result = $this->db->fetchAll(); $collection = array(); foreach ($result as $row) { $collection = new \Todo\Models\User($row['username'], $row['password'], $row['user_id']); } return $collection; }