Jump to content

DateTime + Time in CallbackAfterInsert

callback datetime date add callback_after_insert

  • Please log in to reply
1 reply to this topic

#1 msquare



  • Members
  • Pip
  • 2 posts

Posted 10 March 2013 - 01:46 PM

I have a callback function which needs to add the recently entered datetime, and time from a different table. However, it updates the db with null. I tried re-updating it with the initial datetime input and it works fine. I'm guessing the problem is along the addition part. HELP!


Here's the callback...

function add_path_after_insert($post_array,$primary_key)

    $currentDate = strtotime($pdep);
    $futureDate = $currentDate+(((int)substr($sdep,0,2))*3600)+(((int)substr($sdep,3,2)) * 60) + ((int) substr($sdep,6,2));
    $data = array(
        'dep_datetime' => $futureDate
    $this->db->where('path_id', $primary_key);
    $this->db->update('path', $data); 

    return true;


From the model...

function get_schedDep($path_id)
    $query=$this->db->query('SELECT dep_time FROM schedule JOIN path ON schedule.sched_id= path.sched_id WHERE path_id="'.$path_id.'"');
    return $row->dep_time; 

function get_pathDep($path_id)
    $query=$this->db->query('SELECT dep_datetime FROM path WHERE path_id="'.$path_id.'"');
    return $row->dep_datetime;

#2 davidoster


    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 10 March 2013 - 06:42 PM

Hello and welcome.

Show the controller function that has the add_path_after_insert.



rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---



David Oster aka George Pasparakis,

Also tagged with one or more of these keywords: callback, datetime, date, add, callback_after_insert

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users