![]() |
|
|
#1 |
|
Архивный участник
Join Date: Jan 2006
Posts: 122
|
i need php script to delete items from user_data table by ID...
can someone share it? i will give u all my cash
|
|
|
|
|
#2 |
|
Архивный участник
Join Date: Sep 2005
Posts: 41
|
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);
}
?>
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: Jan 2006
Posts: 122
|
not working =\
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Jun 2005
Posts: 24
|
sql query:
DELETE FROM user_data WHERE char_id='1' |
|
|
|
|
#5 | |
|
Архивный участник
Join Date: Sep 2005
Posts: 41
|
Quote:
what error ? |
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Feb 2006
Posts: 87
|
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. |
|
|
|
|