2017-11-09 3 views

答えて

1

これを試してみてください:

$state = $data['state']; 

// checking `$state has set` 
if (isset($state) && (trim($state) != '')) { 
    $this->db->where('en_movingfrom_state', $state) 
} 
$result = $this->db->select("state")->from('table') 
    ->where('status', 3) 
    ->get()->result_array(); 

// Output 
print_r($result); 
+0

に設定されているかどうかを確認するためにISSET()関数を使用することができますが、それは私のコードに取り組んでいます、ありがとうございます。 –

0

あなたは$状態が

$state = $data['state']; 
$this->db->select("state")->from('table'); 
if(isset($state) && $state != ""){ 
    $this->db->where('en_movingfrom_state', $state); 
} 
$this->db->where('status', 3); 
$this->db->get()->result_array(); 
関連する問題