-1

An error:

Warning: date() expects parameter 2 to be long

This is a postback php scripts part,

$conv_time = time();
$click_time_to_date = new DateTime(date('Y-m-d h:i:s', $mysql['click_time']));
$conv_time_to_date = new DateTime(date('Y-m-d h:i:s', $conv_time));
$diff = $click_time_to_date->diff($conv_time_to_date);
$mysql['time_difference'] =  $db->real_escape_string($diff->d.' days, '.$diff->h.' hours, '.$diff->i.' min and '.$diff->s.' sec');
$mysql['conv_time'] = $db->real_escape_string($conv_time);
$mysql['ip'] = $db->real_escape_string($_SERVER['HTTP_X_FORWARDED_FOR']);
$mysql['user_agent'] = $db->real_escape_string($_SERVER['HTTP_USER_AGENT']);
Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
HELPER
  • 23
  • 4
  • 3
    The datatype of one of your uses in the date() function is not of the type long. A "long" data type is a number, without any other characters, for example a unix timestamp is a long datatype. What is the value of $mysql['click_time'] ? – Santy Dec 27 '15 at 09:31

1 Answers1

0

Your click_time field probably is of type DATETIME, and date() expects the second parameter to be a timestamp (long).

Try replacing line #2 with:

$click_time_to_date = new DateTime($mysql['click_time']);

Or make sure that your click_time field is of type TIMESTAMP.

Inigo Flores
  • 4,461
  • 1
  • 15
  • 36