Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Using DB::expr with set
  • I'm trying to insert into a MySQL database table something like the following but can't figure out the right syntax for setting the field "expiration".
    $set['first_name'] = 'Joe';
    $set['last_name'] = 'Smith';
    $sql = "DATE_ADD(NOW(), INTERVAL (SELECT expiration_days FROM options_access WHERE access_id = $access_id) DAY)";
    $set['expiration'] = "DB::expr($sql)";
    $query = DB::insert('clients)->set($set);

Howdy, Stranger!

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