How do I clear data in a row for all fields? MySQL
#1

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.
Reply
#2

Код:
mysql_query("TRUNCATE TABLE table_name;");
Reply
#3

Not a table, a Specific field in a table.
Reply
#4

Код:
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);
}
Reply
#5

Код:
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;
Reply
#6

Thank you guys!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)