Raised This Month: $51 Target: $400
 12% 

Help with MySQL


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andrzN
Senior Member
Join Date: Jan 2010
Location: Bodø / Norway
Old 08-30-2015 , 08:37   Help with MySQL
Reply With Quote #1

Hey guys!

I need some help, I have a rank system which is connected to a mysql database.
The thing I need help with, is to reset certain coulumns in the mysql table.

Lets say for example I have these tables: kills, deaths, rounds. And I want to set the "kills" and "deaths" for everyone who is stored in the database to 0.

How can I do this through a plugin?

I tried these:

PHP Code:
SQL_ThreadQuery(g_sql_tuple"qh_IgnoreHandle""UPDATE `rank_system` SET `kills=NULL`,`deaths=NULL`;"); 
PHP Code:
SQL_ThreadQuery(g_sql_tuple"qh_IgnoreHandle""EMPTY FROM `rank_system` WHERE `kills=NULL`,`deaths=NULL`;"); 
PHP Code:
SQL_ThreadQuery(g_sql_tuple"qh_IgnoreHandle""DELETE FROM `rank_system` WHERE `kills=NULL`,`deaths=NULL`;"); 
But it doesnt affect any of the players' score.

I really appreciate some help!
andrzN is offline
Send a message via MSN to andrzN
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 08-30-2015 , 11:37   Re: Help with MySQL
Reply With Quote #2

Why not TRUNCATE TABLE?
Phant is offline
Send a message via ICQ to Phant
wickedd
Veteran Member
Join Date: Nov 2009
Old 08-30-2015 , 12:41   Re: Help with MySQL
Reply With Quote #3

PHP Code:
SQL_ThreadQuery(g_sql_tuple"qh_IgnoreHandle""UPDATE `rank_system` SET `kills=NULL`,`deaths=NULL`;"); 


PHP Code:
SQL_ThreadQuery(g_sql_tuple"qh_IgnoreHandle""UPDATE `rank_system` SET `kills` = 0,`deaths` = 0;"); 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-30-2015 , 12:59   Re: Help with MySQL
Reply With Quote #4

You are enclosing the field AND value in quotes, you should only enclose the field; it should be 'Field'=NULL, not 'Field=NULL'. Quotes aren't really needed at all, unless there are spaces in the field, but that's not a good naming practice to begin with.

Code:
UPDATE `rank_system` SET `kills=NULL`,`deaths=NULL`;");

Code:
UPDATE `rank_system` SET `kills'=NULL,`deaths'=NULL;");
__________________
Bugsy 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 11:41.


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