• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Help Me] Commands phpMyAdmin

AlexxNica

WebDev
Joined
Nov 13, 2008
Messages
12
Reaction score
0
Location
Curitiba, Paraná - Brazil
Hello, i need a command SQL to clear the ID 2160 from the table player_depotitems, but i need delete just who have more then 10x itemtype 2160(id).

Like this:
Player ID 9921 have more then 10 items with code 2160(crystal coin), he items will be deleted, all items from id 2160..

Sorry for the bad english.

Waiting Answers !!
 
PHP:
DELETE FROM `player_depotitems` WHERE `itemtype` = '2160' AND `count` >= '10';

It will remove stacks only
 
@Nemaneth
Thanks, but it isn't what i want..

I want a command to delete those who have more than 10kk, example: the guy has 10 items with id 2160, with count = 100, being 10kk .. i want to delete these 10kk of this person, but only from those who have more than 10kk, understand? its complicated .. : /

Sorry for the bad english
 
PHP:
<?php
	$db = new MySQLi("host", "user", "pass", "database");
	
	$players = array();
	
	$query = $db->query("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = '2160';");
	while($fetch = $query->fetch_row())
		if($fetch[1] >= 100)
			$players[$fetch[0]] += 1;
		
	foreach($players as $id => $count)
		if($count >= 10)
		{
			echo "Deleting money from player #{$id}.";
			$db->query("DELETE FROM `player_depotitems` WHERE `itemtype` = '2160' AND `count` = '100' AND `player_id` = '{$id}' LIMIT 10;");
		}
		
	$db->close();
?>
 
Last edited:
Back
Top