Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Help (https://postpacific.mmorpg-game.online/forumdisplay.php?f=37)
-   -   ≈ delet items from user_data table (https://postpacific.mmorpg-game.online/showthread.php?t=3917)

pipise4ko 05.04.2006 21:55

delet items from user_data table
 
i need php script to delete items from user_data table by ID...
can someone share it? i will give u all my cash :D

darkkiss 05.04.2006 22:13

lol .. that's simple :)

Code:

<?php

$dbaddress = "1xx.xx8.0.1"; // your db ip
$dbuser = "salogin"; // your SA login
$dbpass = "************"; // your password

// * DO NOT EDIT BELLOW :) * \\


$geti = $_GET['id'];
$getr = $_GET['req'];

function connectdb($db) {
  $dbconnect = mssql_connect ($dbaddress, $dbuser, $dbpass);
  mssql_select_db ($db, $dbconnect) or die (mysql_error());
}
function deleteitem($id){
  connectdb("lin2world");
  mssql_query("DELETE FROM user_item WHERE item_type='$id'");
}
if((!$getr) || (!$geti)){
?>
Delete item:


<form method="get">
Item ID: <input type="text" name="id">

<input type="hidden" name="req" value="1">

<input type="submit" value="DELETE IT">
</form>
<?php
}else{
deleteitem($geti);
}
?>

should work ... test 1'st :)

pipise4ko 05.04.2006 22:29

not working =\

f1rsty 05.04.2006 22:44

sql query:
DELETE FROM user_data WHERE char_id='1'

darkkiss 05.04.2006 23:39

Quote:

Originally Posted by pipise4ko
not working =\

lol?

what error ?

Sire 06.04.2006 01:41

user_data only stores the ids for the items that are equipped in each slot. The items themselves are in user_item.

To delete the item from table just run a SQL Query:
DELETE FROM user_item WHERE item_id = 999

Note that 999 is a number, so you don't need quotes as the post above states.

You can also do it by character:
DELETE FROM user_item WHERE char_id = 777

That will delete all the items belonging to char with id of 777.
If you dont know the char_id you can just do:
DELETE FROM user_item WHERE item_id IN (SELECT user_item.item_id FROM user_item INNER JOIN user_data ON user_item.char_id = user_data.char_id WHERE user_data.char_name = 'MyName')

That will delete all items from character named MyName.


Theres enough there to work with, you can just change things or add in what you need.

That will delete all items from the character named MyName.


All times are GMT. The time now is 22:49.