Jump to content
Larry Ullman's Book Forums

ronallensmith

Members
  • Posts

    28
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by ronallensmith

  1. SOLVED: The following was added to myModel.php

     

    // added to insert endTime upon record INSERT
        public function behaviors()
        {
            return array(
                'CTimestampBehavior' => array(
                'class' => 'zii.behaviors.CTimestampBehavior',
                'createAttribute' => 'endTime',
                'updateAttribute' => NULL,
                )
            );
        }

  2. SOLVED: The following was added to myModelController.php

     

    public function actionCreate()
    {
            $model=new TblContacts; // default code
            
            // added to insert startTime into _form
            $model->startTime=date('Y-m-d H:i:s', strtotime('-7 Hours'));

     

           // default code following

    }

  3. Hi,

     

    I'm new to Yii and did Larry's series "Learning the Yii Framework" and I'm having an issue with CURRENT_TIMESTAMP and probably DATETIME not displaying in the 'protected.../...employee/create' view "_form.php" when doing the INSERTs.

     

    If I do the INSERTs to the "employee" table using phpMyAdmin, the CURRENT_TIMESTAMP variable displays, and MySQL works from the console:

     

    mysql> select current_timestamp();
    +---------------------+
    | current_timestamp() |
    +---------------------+
    | 2013-07-30 23:46:30 |
    +---------------------+
    1 row in set (0.00 sec)

     

    Is this a "Windows" thing?

     

    Windows XP

    Apache 2.4.4

    MySQL 5.6.12

    PHP 5.4.16

    WampServer 2.4

     

×
×
  • Create New...