Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Help

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 29.01.2007, 15:59   #5
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

I cant understand why you do this --> $qtd = mssql_result($query1,0,"warehouse");

And later... that query... LOL...

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'

you are updating all the fields, but not only that... warehouse field... must be 0 or 1... 0 for inventary, 1 for warehouse..

umm.. now i took a look again i think your mistake is you think warehouse field is amount of the item in warehouse...


Try with this (im not try to test the code, i only fast rewrite all the issues i see)

Code:
<? 

$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'];

$result = mssql_query("SELECT amount,item_id FROM user_item WHERE char_id = $idchar AND item_type = $item_id AND warehouse = 1);

$rows = mssql_num_rows($result);
$dbamount = mssql_result($result, 0, 0);
$dbitemid = mssql_result($result, 0, 1);

$nqtd = $nqtd+$dbamount;

if ($dbamount > 0) {
  mssql_query("UPDATE user_item SET amount = $nqtd WHERE item_id = $dbitemid");
  echo "<center><font face=verdana size=2 color=green>Tickets Entregues com sucesso!</font></center>";
}
else {
  mssql_query("INSERT INTO user_item (char_id, item_type, amount, enchant, eroded, bless, ident, wished, warehouse) values ($idchar,$item_id,$nqtd,0,0,0,0,0,1)"); 
  echo "<center><font face=verdana size=2 color=green>Tickets Entregues com sucesso!</font></center>";
}

$conn=mssql_close(); 

?>
FidoW is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:23.