0

I want to post the now() function in my mysqli but there is no output. When I use the time ('NOW()') I get 838:59:59.

<?php
public function ajax_add()
{
    $this->_validate();
    $data = array(
        'datum' => date('Y-m-d'),
        'firma' => $this->input->post('firma'),
        'naam' => $this->input->post('naam'),
        'telefoonnummer' => $this->input->post('telefoonnummer'),
        'opdrachtgever' => $this->input->post('opdrachtgever'),
        'werkzaamheden' => $this->input->post('werkzaamheden'),
        'aangemeld' => $this->input->post('aangemeld'),
        'pasnummer' => $this->input->post('pasnummer'),
        'aangemeld' => time('NOW()')
        );
    $insert = $this->person->save($data);
}
?>

What am I missing?

Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
junr
  • 27
  • 3

3 Answers3

1

Remove aangemeld from the $data array and set it like this:

$this->db->set('aangemeld', 'NOW()', FALSE);

Then call your save()

Amir
  • 98
  • 1
  • 1
  • 5
0

I guess here is the problem with your this line

'aangemeld' => time('NOW()')

time() method doesn't have any parameters.

If you want to pass now as an unix timestamp you should use just

time()

If you want you can pass like this:

date("d/m/Y H:i:s");

Eray İzgi
  • 36
  • 4
0

Use

 date('Y-m-d H:i:s')

instead of

'aangemeld' => time('NOW()')

For current timestamp

time() dont have parameters.

Jatin Raikwar
  • 406
  • 5
  • 17