⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

$ This-> grocery crud-> like ( 'table', '___') does not work why?



firdavs
  • profile picture
  • Member

Posted 28 February 2016 - 18:02 PM

Why does not the $ this-> grocery crud-> like ( 'table', '___')? How to display data from a table in which 3 characters

 


firdavs
  • profile picture
  • Member

Posted 28 February 2016 - 18:12 PM

HEEEEELLLLLPPPPP


Amit Shah
  • profile picture
  • Member

Posted 28 February 2016 - 18:38 PM

Can you be please clear with what you expecting out . and trying to do / achieve?


firdavs
  • profile picture
  • Member

Posted 01 March 2016 - 04:32 AM

$this->grocery_crud = new grocery_CRUD();
  $this->grocery_crud->set_table('mkb_10');
$this->grocery_crud->set_theme("twitter-bootstrap");
  $this->grocery_crud->columns('Number','text', 'go'); 
$this->grocery_crud->set_relation_n_n('go', 'all_id','position', 'id_mkb_10', 'id_position', 'Name_RU');
$this->grocery_crud->fields('text', 'go');
$this->grocery_crud->display_as('Number', 'â„–')
  ->display_as('text', 'Name')
                    ->display_as('go', 'who');
 
$this->grocery_crud->unset_add();   
$this->grocery_crud->unset_export();
$this->grocery_crud->unset_print();
$this->grocery_crud->unset_delete();
  $output = $this->grocery_crud->render();
  $this->_example_output($output);

 

 
I have a base , I want to grocery crud pulled me those details that have 3 characters . For example, in SQL: select name from mkb_10 where Number like "___"

Amit Shah
  • profile picture
  • Member

Posted 01 March 2016 - 07:56 AM

Well its simple, GroceryCrud documentation could have helped you easily..

 

$this->grocery_crud->set_relation_n_n('go', 'all_id','position', 'id_mkb_10', 'id_position', 'Name_RU', array('Number like "___"'));

You could simply add the where clause to relation_n_n ... as you would have done it in CI active records or $crud->where

 

Happy CGing :)


firdavs
  • profile picture
  • Member

Posted 02 March 2016 - 05:13 AM

Thanks , you're a genius