How do I clear data in a row for all fields? MySQL - 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: How do I clear data in a row for all fields? MySQL (
/showthread.php?tid=504867)
How do I clear data in a row for all fields? MySQL -
Dokins - 06.04.2014
Basically, I want to remove everyone's weapons from MySQL.
How do I do this via PhpMyAdmin?
So I want to set
Wep0 = 0
Wep1 = 0
All the way to 12.
Re: How do I clear data in a row for all fields? MySQL -
VishvaJeet - 06.04.2014
Код:
mysql_query("TRUNCATE TABLE table_name;");
Re: How do I clear data in a row for all fields? MySQL -
Dokins - 06.04.2014
Not a table, a Specific field in a table.
Re: How do I clear data in a row for all fields? MySQL -
VishvaJeet - 06.04.2014
Код:
new str[128];
format(str,128,"UPDATE table_name SET wep0='0', wep1='0', wep2='0', wep3='0', wep4='0', wep5='0', wep6='0',........ wep12='0' WHERE username='%s'",name);
mysql_query(str);
Or
Код:
for(new i=0; i < 13; i++)
{
new str[128];
format(str,128,"UPDATE table_name SET wep%d='0' WHERE username='%s'",i,name);
mysql_query(str);
}
Re: How do I clear data in a row for all fields? MySQL -
Dubya - 06.04.2014
Код:
UPDATE table_name SET wep0='0', wep1='0', wep2='0', wep3='0', wep4='0', wep5='0', wep6='0', wep7='0', wep8='0', wep9='0', wep10='0', wep11='0', wep12='0' WHERE 1;
Re: How do I clear data in a row for all fields? MySQL -
Dokins - 06.04.2014
Thank you guys!