Hello, thanks for reading my question.
I've created a banned member table that bans a user for XX number of days. The table stores Member ID and TimeDate stamp from MySQL Now. The table is set for Time and Date as XXXX-XX-XX NN:NN:NN
I searched MySQL timedate stuff and found this nifty timestampdiff thing but I'm not sure if this is the proper syntax, basically I copied and pasted it from the example except I changed to SQL_TSI_DAY
The orignal example follows:
SELECT timestampdiff(SQL_TSI_MONTH, {ts “1998-01-11 10:00:00”}, {ts “1998-03-11 10:00:00”})
With this I want todays date / time i.e. NOW() and the Field in the data base named Date
$BanDays = integer in days that the user may not use the shout box
$SQLTimeDiff = " timestampdiff(SQL_TSI_DAY, {ts “NOW()”}, {ts “Date”}) > {$BanDays}";
$Banned = dbArr( "SELECT `ID`FROM `ShoutBoxBan` WHERE `MemID` = {$MemCookie['ID']} AND {$SQLTimeDiff} LIMIT 1" );
- I've never seen this {ts “1998-01-11 10:00:00”} format in SQL query before, is this correct??
- Because I can't seem to find any info on "ts" is the above format correct to use the data in the date table i.e. the {ts “Date”} basically want it to fetch the data in the date table and this date is the date the user was banned from the shout box.
- Should this work like this or are there better ways?
I would just test it out but I'm at work, I'll try this evening unless someone points out some error or knows a better way of doing this.