where_in codeigniter

// Step 1: Load the CodeIgniter database library
$this->load->database();

// Step 2: Define an array of values for the WHERE IN clause
$ids = array(1, 2, 3, 4, 5);

// Step 3: Use the where_in() method to generate the WHERE IN clause
$this->db->where_in('column_name', $ids);

// Step 4: Perform a SELECT query with the generated WHERE IN clause
$query = $this->db->get('table_name');

// Step 5: Check if the query was successful and retrieve the results
if ($query->num_rows() > 0) {
    foreach ($query->result() as $row) {
        // Process each row as needed
    }
}

// Step 6: Optionally, free up the query result
$query->free_result();