使用PHP检索多行数据

I'm trying to create a function that runs a query that returns all of the data located in my MySQL database.

My current code only returns the one row of data (there are 7)

function staff_get() {
    $this->load->database();
    $sql = 'SELECT * from Staff';
    $query = $this->db->query($sql);
    $data = $query->row();
    $this->response($data, 200);
}

I'd imagine it has something to do with the line "$data = $query->row();" however I've tried switching "row" with "array" but this doesn't work. The text is designed to come out as plaintext so that I can manipulate it using a jQuery template.

Thank you for your help in advance.

You need to encase the results in a while loop. Something along the lines of this.

function staff_get() {
    $this->load->database();
    $sql = 'SELECT * from Staff';
    $query = $this->db->query($sql);
    while($data = $query->row()) {
        $this->response($data, 200);
    }
}