0

I want to add multiple values in where clause.

------------As In Sql , we do like this------------------

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)

How to use this in grocery crud?

Mat
  • 202,337
  • 40
  • 393
  • 406
abhishek02
  • 3
  • 1
  • 6

2 Answers2

2

The WHERE clause in GroceryCrud works exactly like codeigniter's WHERE clause:

$this->db->where_in('columnname', $arrayvalues);

Hope this helps you, don't hesitate to ask further questions =)

GroceryCrud Documentaion WHERE

kscius
  • 376
  • 9
  • 13
Crowlix
  • 1,269
  • 9
  • 19
0

use or_where instead of where .

e.g

function example_with_or_where() {

    $crud = new grocery_CRUD();

    $crud->where('productName','Motorcycle');
    $crud->or_where('productName','Car');
    $crud->or_where('productName','Bicycle');

    $crud->set_table('products');
    $crud->columns('productName','buyPrice');

    $output = $crud->render();

    $this->_example_output($output);
}

detail here

Haseeb
  • 2,214
  • 1
  • 22
  • 43