⚠ 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

codeigniter dropdown from database



DREON

DREON
  • profile picture
  • Member

Posted 16 May 2013 - 04:55 AM

hi to all masters,

 

i have a question that connected to GC table,

 

i have this boostrap dropdown

 

<li class="dropdown">  
                                  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-plus"></i> DROP DOWN<b class="caret"></b></a>  
                                  <ul class="dropdown-menu">  
                     
                                   </ul>  
                        </li>

 

 

and my question is how can i create a drop down list from my database:

example i have table:

 

"years" with columns

id |  years

1      2013-2014

2       2014-2015

 

i want to create a dropdown on this table years:

 

and when i click example 2013-2014 dropdown

 

it will show me a gc table with only 2013-2014 data.

 


davidoster

davidoster
  • profile picture
  • Member

Posted 16 May 2013 - 06:10 AM

Hello [member=dreon].

 

1. First of all this is not a GC table. This means that your data is on a database table, e.g. MySQL and you instruct Grocery CRUD to manipulate this table and the data within.

2. Since it is a database table you can easily make a Grocery CRUD grid/view (you know how, you've done it before) and display the data but this will display them in a format depending on the theme you have chosen.

3. Now, since you are saying about a bootstrap column I need to remind you that this is not supported on the latest stable version of GC, so basically sorry we can not give you any support on this.

4. If I forget about the bootstrap column and try to help you out with this (lost count how many questions you have asked till now in general) this is simple

$crud = new grocery_CRUD();
$crud->set_table('years');
$crud->where('years', '2013-2014');

If this is not what you need, then just study here.