This topic is locked

Automatic update and time picker

6/14/2006 6:01:46 AM
PHPRunner General questions
O
osluk author

I have been trying to polish the application by adding an automatic reord of the user logged in and the time of reord creation and updates.
I cannot get any of the required steps to correctly work.
Also it does not seem the date picker can be used to specify time as this is greyed out.
I have tried all kinds of variations on the current timestamp and now() functions all to no avail.
Use of undefined constant CURRENT_TIMESTAMP - assumed 'CURRENT_TIMESTAMP'
Can someone confirm the field type required and what else I might be missing.
Cheers Chris


To sort edits done during the same day I need the time being recorded


Greyed out option


Option in PHP myadmin


Option with Navicat

Sergey Kornilov admin 6/14/2006

Chris,
you mixing apples and oranges here.

  1. Timepicker is only available when you choose "Simple edit box with datepicker". There is no way to display time when you choose dropdown boxes. It works the same way in phpMyAdmin.
  2. To update a field with timestamp when record is created or updated you need to use Events.

    Make sure timestamp field appears on Add/Edit pages as Hidden field.

    Use BeforeAdd/BeforeEdit events to assign value to this field.
    function BeforeEdit(&$values, $where)

    {
    $values["Updated"]="now()";
    return true;
    // return true if you like to proceed with editing this record

    // return false in other case

    }

zzapper 11/27/2007

Chris,

you mixing apples and oranges here.

  1. Timepicker is only available when you choose "Simple edit box with datepicker". There is no way to display time when you choose dropdown boxes. It works the same way in phpMyAdmin.
  2. To update a field with timestamp when record is created or updated you need to use Events.

    Make sure timestamp field appears on Add/Edit pages as Hidden field.

    Use BeforeAdd/BeforeEdit events to assign value to this field.