⚠ 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

get the country name?



naveen
  • profile picture
  • Member

Posted 09 February 2012 - 07:48 AM

HI this is naveen.

I have a one doubt,
how do i get the state from DB while select the country.

this is my code

public function manageUsers()
{

$crud = new grocery_CRUD();
$crud->set_table('tb_users');
$crud->columns('email','fname','lname','dob','gender','country','state','city','address');
$crud->display_as('fname','First Name ')
->display_as('lname','Last Name')
->display_as('dob','Age');
$this->grocery_crud->unset_columns('user_password','subscribed_date');
$this->grocery_crud->set_rules('email', 'email','trim|required|xss_clean|callback_username_check');
$crud->fields('email','fname','lname','dob','gender','country','state','city','address');
$this->grocery_crud->set_subject('USER');

$crud->callback_column('state',array($this,'getState'));
//get the country and State name while performing JOIN operation
$crud->set_relation('country','tb_countries','country');
$crud->set_relation('state','tb_states_master','State_Name');

$output = $crud->render();
$this->_example_output($output);
}}


By default select the country it and in state it display all states my database. how to solve this one?

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 09 February 2012 - 18:59 PM

/topic/127-select-based-on-a-previous-select/page__view__findpost__p__435