AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sql update old=old+1 (https://forums.alliedmods.net/showthread.php?t=229664)

w2zzaaa 11-11-2013 19:52

Sql update old=old+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)

Clauu 11-12-2013 05:54

Re: Sql update old=old+1
 
PHP Code:

UPDATE .. improve=improve+


w2zzaaa 11-12-2013 11:10

Re: Sql update old=old+1
 
wtf :D its work, thanks :D


All times are GMT -4. The time now is 23:18.

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