Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Help
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 05.04.2006, 21:55   #1
pipise4ko
Архивный участник
 
Join Date: Jan 2006
Posts: 122
Default 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
pipise4ko is offline  
Old 05.04.2006, 22:13   #2
darkkiss
Архивный участник
 
Join Date: Sep 2005
Posts: 41
Default

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
darkkiss is offline  
Old 05.04.2006, 22:29   #3
pipise4ko
Архивный участник
 
Join Date: Jan 2006
Posts: 122
Default

not working =\
pipise4ko is offline  
Old 05.04.2006, 22:44   #4
f1rsty
Архивный участник
 
Join Date: Jun 2005
Posts: 24
Default

sql query:
DELETE FROM user_data WHERE char_id='1'
f1rsty is offline  
Old 05.04.2006, 23:39   #5
darkkiss
Архивный участник
 
Join Date: Sep 2005
Posts: 41
Default

Quote:
Originally Posted by pipise4ko
not working =\
lol?

what error ?
darkkiss is offline  
Old 06.04.2006, 01:41   #6
Sire
Архивный участник
 
Join Date: Feb 2006
Posts: 87
Default

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.
Sire is offline  
 


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. The time now is 22:57.