0

iam building my web app, and i need to the simplest thing, just update fields inside table with some variables,but its not working he doesnt do anything ,values of the fields remain just as it was.

public function post_eupdate(){

  $update = DB::table('app_events')
      ->where('ev_id', '=', Input::get("id"))
      ->update(
          array(
             'ev_op1'    =>  Input::get('op1'),
             'ev_op2'    => Input::get('op2'),
             'ev_coef1'  => Input::get('coef1'),
             'ev_coef2'  => Input::get('coef2'),
             'ev_host'   => Input::get('host'),
             'ev_stime'  => Input::get('stime'),
             'ev_ns1'    => Input::get('ns1'),
             'ev_cat'    => Input::get('cat'),
             'ev_tip'    => Input::get('tip'),
             'ev_ns2'    => Input::get('ns2')
         )
     );
Davit Zeynalyan
  • 8,418
  • 5
  • 30
  • 55
Silvio Marijic
  • 483
  • 4
  • 12
  • 22
  • 1
    Maybe it's not the ID you're looking for. Did you var dump Input::all() to see what it contains? – Damien Pirsy Jan 23 '13 at 19:30
  • i checked that its fine, but the intresting thing is that when i do this 'ev_op1' => "Input::get('op1')", it works but its inserting literally Input::get('op1') – Silvio Marijic Jan 23 '13 at 19:34
  • It would indicate that Input::get('id') doesn't contain a valid 'ev_id' that is in the database. var_dump the Input::get('id') and manually check if that id is in the database. – David Barker Jan 24 '13 at 02:07

1 Answers1

0

Your update statements seams good.

My guess would be that the problem is that Input::get("id") isn't a valid id for app_events.ev_id

Try debugging this by replacing ->update with ->get(). If this return null you would know that my assumption is correct. (If not post it in you question.)

As this is the case you have to modify the Input and not this piece of code which makes your question no longer fitting for the problem.

AndHeiberg
  • 1,029
  • 1
  • 10
  • 29