0

I need to get database information from table by using where clause from a select options.

My view:

<div>
    <select name="noSeats" class="form-control" placeholder="Seats">
        <option value="">Seats</option>
        <option value="45">45</option>
        <option value="49">49</option>
        <option value="51">51</option>
        <option value="53">53</option>
        <option value="56">56</option>
        <option value="57">57</option>
        <option value="61">61</option>
    </select>
</div>

My Model:

public function getSeats($noSeats) {
    $query = $this->db->get('seat');
    if ($query->num_rows() > 0) {
        return $query->result();
    }    
}

Also I have another problem with listing checkboxes; I need to list checkboxes in row of limit to 4 since I have many chechboxes.

enter image description here

0

2 Answers 2

1
public function getSeats($noSeats){
      $query = $this->db->from('seat')->where('seat_col', $noSeats)->get();
      if($query->num_rows() > 0){
      return $query->result();
      }  
 }
Sign up to request clarification or add additional context in comments.

2 Comments

I need those check boxes to appear after choosing number of seats
This function is returning the result of seats, so you can pass these seats to the view.
1

You can use

$query = $this->db->where('COLUMN_NAME', $noSeats )->get('seat');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.