Raised This Month: $ Target: $400
 0% 

[CSS] time as argument and as field in database


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PriceLess
Senior Member
Join Date: Sep 2012
Location: Jungle
Old 03-08-2013 , 10:47   [CSS] time as argument and as field in database
Reply With Quote #1

Hello, I was wondering how could I make <time> as an argument, and how would I define this at "INSERT INTO %s (time) VALUES('%wut?')", Table, What?
__________________
sincerely PriceLess

Last edited by PriceLess; 03-08-2013 at 11:39.
PriceLess is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 03-08-2013 , 11:54   Re: [CSS] time as argument and as field in database
Reply With Quote #2

check SQL syntax, there must be something like 'current_timestamp' or TIME
I am using "INSERT INTO %s VALUES (%i)", dbstring, GetTime()
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot

Last edited by Root_; 03-08-2013 at 11:54.
Root_ is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-08-2013 , 12:02   Re: [CSS] time as argument and as field in database
Reply With Quote #3

Create the row like so:
Code:
`time` timestamp NOT NULL default CURRENT_TIMESTAMP,
Then use a SELECT statement to get "UNIX_TIMESTAMP(time)" and "UNIX_TIMESTAMP()" to compare against. That way there's no discrepancy between the time on the MySQL server and the SRCDS server.
bl4nk is offline
PriceLess
Senior Member
Join Date: Sep 2012
Location: Jungle
Old 03-08-2013 , 12:26   Re: [CSS] time as argument and as field in database
Reply With Quote #4

PHP Code:
decl String:Query[200];
decl String:time[20];

GetCmdArg(1timesizeof(time));

new 
time2 StringToInt(time);

Format(Querysizeof(Query), "INSERT INTO %s (time, time2) VALUES (%d, %d)"tableUNIX_TIMESTAMP(time2), UNIX_TIMESTAMP()); 
I dont get how I would do that.
__________________
sincerely PriceLess

Last edited by PriceLess; 03-08-2013 at 12:53. Reason: forgot the string ^^,
PriceLess is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 03-08-2013 , 13:33   Re: [CSS] time as argument and as field in database
Reply With Quote #5

you should insert it as a query
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode