Raised This Month: $ Target: $400
 0% 

Sql update old=old+1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
w2zzaaa
Junior Member
Join Date: Feb 2010
Old 11-11-2013 , 19:52   Sql update old=old+1
Reply With Quote #1

i use this plugin:
http://forums.alliedmods.net/showthread.php?t=130417

and add one more column to db:
Code:
`improve` int(10) NOT NULL DEFAULT '0',
Default is improve value 0, now if someone improve his previous time, then how i add every time to improve value "+1"?
i try;
Code:
formatex(createinto, sizeof createinto - 1, "UPDATE `%s` SET time='%f', weapon='%s', date='%s', improve='+1' ,server='%s'%s%s WHERE authid='%s' AND mapname='%s'", style == PRO_TOP ? "kz_pro15" : "kz_nub15", newtime, g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP ? "" : gochecks, style == PRO_TOP ? "" : checkpoints, steam, map)
or something like that?;

Code:
Handle:Query=SQL_PrepareQuery( SqlConnection, "SELECT improve FROM `kz_pro15` WHERE authid='%s' AND mapname='%s'", authid, mapname)
$oldimprove=Handle:Query
and then add +1 to old improve value....

Code:
formatex(createinto, sizeof createinto - 1, "UPDATE `%s` SET time='%f',  weapon='%s', date='%s', improve='$oldimprove+1' ,server='%s'%s%s WHERE authid='%s'  AND mapname='%s'", style == PRO_TOP ? "kz_pro15" : "kz_nub15", newtime,  g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP ? "" :  gochecks, style == PRO_TOP ? "" : checkpoints, steam, map)

Last edited by w2zzaaa; 11-11-2013 at 19:55.
w2zzaaa is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 11-12-2013 , 05:54   Re: Sql update old=old+1
Reply With Quote #2

PHP Code:
UPDATE .. improve=improve+
Clauu is offline
w2zzaaa
Junior Member
Join Date: Feb 2010
Old 11-12-2013 , 11:10   Re: Sql update old=old+1
Reply With Quote #3

wtf its work, thanks
w2zzaaa 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 23:18.


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