SA-MP Forums Archive
Date saving to mysql and writing to enum - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Date saving to mysql and writing to enum (/showthread.php?tid=548508)



Date saving to mysql and writing to enum - bogushas - 30.11.2014

PHP код:
        new yearmonthday;
        
getdate(year,month,day);
        
format(verslasapID[playerid] ][ vData ], 21,"%02d/%02d/%d"daymonthyear);
        
verslasapID[playerid] ][ vPelnas ] -= money;
        
format(verslasapID[playerid] ][ vThief ], MAX_PLAYER_NAME"%s"getPlayerName(playerid));
        
verslasapID[playerid] ][ vSPelnas ] += money;
        
format(g_szBuffersizeof g_szBuffer"UPDATE "MySQL_BUSINESS_TABLE" SET Pelnas = '%i', Pavogta = '%i', Vagis = '%s', lastData = '%i' WHERE ID = '%i'"verslasapID[playerid] ][ vPelnas ],verslasapID[playerid] ][ vSPelnas ],verslasapID[playerid] ][ vThief ],verslasapID[playerid] ][ vData ], apID[playerid])  ;
        
sql_query(sqlg_szBufferQUERY_THREADED); 
Sorry that code is in Lithuania speach. But vData doesn't saves as it should be. In enum it's : vData[21]


Re: Date saving to mysql and writing to enum - Misiur - 30.11.2014

Change
pawn Код:
lastData = '%i'
to
pawn Код:
lastData = '%s'
Also escape your inputs to prevent SQLi


Re: Date saving to mysql and writing to enum - bogushas - 30.11.2014

Fixed.