dashed-slug.net › Forums › General discussion › Timezones of Moves › Reply To: Timezones of Moves
May 6, 2019 at 10:49 am
#6266
alexg
Keymaster
Hello,
If your database version is earlier than 5.6, then CONVERT_TZ()
will not work and you can use DATE_SUB()
or some other method. I believe you should remove some extra characters from your query, so rewrite your code like so:
$sql3 = "SELECT COUNT(*) FROM $walletTable WHERE DATE_SUB(created_time, INTERVAL 6 HOUR) >='$fromDate' AND DATE_SUB(created_time, INTERVAL 6 HOUR)<='$endDate' AND account='$account' AND category='move' ";
If you don’t trust your inputs, you should use $wpdb->prepare()
instead of relying on PHP string interpolation to insert the variable values. But if you are in control the inputs it should not matter.
with regards