Please tell me how you can pass the value to the parameter:

$star = $this->input->get('star'); 

This code gets the number from the table and passes the value of $ star to the code above:

 $this->db->join('q_rev', 'q_res.res_id = q_rev.rev_itemid', 'left'); $this->db->select_avg('rev_overall', 'overall'); $this->db->where('overall', $star); 

I need to make a condition that passes the value to the $ star parameter. If the obtained value of the table is from 0 to 2.4 (for example, 1.3), we transfer 1. If from 2.5 to 4.4, we transfer 2.

I try the condition below, it does not work. It takes data anyway from $ this-> db-> where ('overall', $ star);, excluding the if condition.

 if($star > '0' && $star < '2.4'){ // передать $star что это 1 } if($star > '2.5' && $star < '4.4'){ // передать $star что это 2 } 

How can you implement? Can make another condition? Thank.

  • Why do you need to override one and the same variable. The task is not quite clear, I would think that you just want to substitute $star = 1; in the right place $star = 1; - Shadow33
  • I need to make a condition that if received from 0 to 2.4, issue 1., etc. $ star = 1; tried, but reads all the same from request $ this-> db-> where ('overall', $ star); ignoring if conditions - kate
  • so you have already written in principle. or I just don't understand you that way - Shadow33
  • give more complete code then - Shadow33
  • I tried to describe the essence in detail and added the rest of the code. - kate

0