View Single Post
Old 29.01.2007, 15:30   #4
yokohiro
Архивный участник
 
Join Date: Jan 2007
Posts: 18
Default

I developed one script where it inserts the item in warehouse of char. however it is not functioning correctly, pos the item cannot be removed of warehouse. I go post code to facilitate


Code:
<meta http-equiv="refresh" content="3;URL=index.php">
<? 
//include "session.php";
$ip="127.0.0.1"; 
$user="sa";
$pass="";
$db="lin2world";

$conn=mssql_connect($ip,$user,$pass); 
mssql_select_db($db, $conn); 

$idchar = $_POST["idchar"];
$nqtd = $_POST["nqtd"];
$item_id = $_POST['item_id'];
//$local = $_POST['local'];

$query1 = mssql_query("select warehouse from user_item where char_id='$idchar' and item_type='$item_id'");
$result1 = mssql_num_rows($query1);
//$result2 = mssql_fetch_array($query1);

$qtd = mssql_result($query1,0,"warehouse");
		$nqtd = $nqtd+$qtd;
	if ($result1 !=0)
		{
			$rsalterar = mssql_query("update user_item set char_id='$idchar', item_type='$item_id',amount='0',enchant='0', eroded='0', bless='0', ident='0', wished='0', warehouse='$nqtd' where item_type='$item_id' and char_id='$idchar'");
			echo "<center><font face=verdana size=2 color=green>Tickets Entregues com sucesso!</font></center>";
		}
	else
		{
		$query = mssql_query("insert into  user_item (char_id, item_type, amount, enchant, eroded, bless, ident, wished, warehouse) values ('$idchar','$item_id','0','0','0','0','0','0','$nqtd')"); 
			echo "<center><font face=verdana size=2 color=green>Tickets Entregues com sucesso!</font></center>";
	
		}
$conn=mssql_close(); 
?>


what he will be that this making a mistake?
yokohiro is offline