0

I got these errors on my script error log iam using php version 5.3 and this is my code :

// add entry
                $sql  = "INSERT INTO plugin_reward_ppd_detail (reward_user_id, download_ip, file_id, download_country_group_id, download_date, reward_amount, status)
                    VALUES (:reward_user_id, :download_ip, :file_id, :download_country_group_id, :download_date, :reward_amount, 'pending')";
                $vals = array('reward_user_id'            => $file->userId,
                    'download_ip'               => $usersIp,
                    'file_id'                   => $file->id,
                    'download_country_group_id' => $countryGroupId,
                    **'download_date'             => sqlDateTime(),**
                    'reward_amount'             => $rewardAmount);
                $db->query($sql, $vals);
            }

I got error on this exactly :

'download_date' => sqlDateTime()

Reena Mori
  • 647
  • 6
  • 15
nagy00
  • 7

1 Answers1

0

if you want add current time on download_date column you can try this one

     use DATE(''YYYY-MM-DD HH:MM:SS');
        $vals = array('reward_user_id'            => $file->userId,
                'download_ip'               => $usersIp,
                'file_id'                   => $file->id,
                'download_country_group_id' => $countryGroupId,
                'download_date'             =>DATE('YYYY-MM-DD HH:MM:SS'),
                'reward_amount'             => $rewardAmount);
            $db->query($sql, $vals);
        }

OR

  other wise set download_date MySQL data-type: TIMESTAMP –
    Defulat value select :  CURRENT_TIMESTAMP   
     This an advanced version of DATETIME datatype. It has the same format as before. Unlike DATETIME, TIMESTAMP stores the current date and time on the creation of the table and on every update automatically. You do
     not need to change its value every time
Reena Mori
  • 647
  • 6
  • 15