I am using the below function to get data from a mysql db
The code wrap from my mododel.php is:
function get_all_devices($user_id = NULL) {
if ($user_id) {
$sql = "
SELECT *
FROM {$this->_db}
WHERE user_id = " . $this->db->escape($user_id) . "
";
$query = $this->db->query($sql);
if ($query->num_rows()) {
return $query->row_array();
}
}
return FALSE;
}
The DB structure cols : id, user_id, device, value
But its extracting only the last record. How can i get all the records in a array.