1

I want to compare two values in where condition by codeigniter query.

Please help me as soon is possible.

<?php
$This->db->select('$a');

$This->db->where('a',$a and 'b','$b');

$This->db->from('tab');

$get = $this->db->get();

?>

1 Answer 1

1
<?php
$This->db->select('$a');
$cond = array(
           'a'=> $a,
           'b'=>$b
     );
$This->db->where($cond);

$This->db->from('tab');

$get = $this->db->get();

?>

when you want to more than one condition in where clause you have to use associative array as per codeigniter active class refer the codeigniter docs for more information.

Sign up to request clarification or add additional context in comments.

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.