Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Heip: populating select form from DB
  • Hi guys, plz how do I populate (Form::select) from DB? Any sample code will be of great help. regards
  • That is documented (see Database, Usage):
    $result = DB::select()->from('users')->execute();
    
    // returns an array with 'id' => 'email' pairs for every record in the resultset
    $key_value_array = $result->as_array('id', 'email');
    
    // now you can do something with $id or $email
    foreach($key_value_array as $id => $email)
    {
        ....
    }
    
  • Thanks. Didn't read that earlier

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion