boots Posted January 4, 2012 Posted January 4, 2012 (edited) It seems the item's found on the streets go into inventory as single items cant get them to group :( } else if($_GET['search'] == 2) { if($rand == 1) { $db->query("INSERT INTO `inventory` VALUES('',$itemidsearch2,$userid,$quantitysearch2)"); echo "<span style='color:green;font-weight:700;'>Success</span><br />While searching ".$cityname." you found an mysterious item. Go to your inventory to find out what"; } else { this is what i have changed but dont work as you guys will know $db->query("UPDATE INTO inventory SET('',$itemidsearch8,$userid,$quantitysearch8)"); where am i going wrong ? function item_add($user, $itemid, $qty, $notid=0) { global $db; if($notid > 0) { $q=$db->query("SELECT * FROM inventory WHERE inv_userid={$user} and inv_itemid={$itemid} AND inv_id != {$notid}"); } else { $q=$db->query("SELECT * FROM inventory WHERE inv_userid={$user} and inv_itemid={$itemid}"); } if($db->num_rows($q) > 0) { $r=$db->fetch_row($q); $db->query("UPDATE inventory SET inv_qty=inv_qty+{$qty} WHERE inv_id={$r['inv_id']}"); } else { $db->query("INSERT INTO inventory (inv_itemid, inv_userid, inv_qty) VALUES ({$itemid}, {$user}, {$qty})"); } } i found this on the furums but just dont know how to add it to the script :( Edited January 4, 2012 by boots added more info Quote
lucky3809 Posted January 4, 2012 Posted January 4, 2012 (edited) Instead of... $db->query("INSERT INTO `inventory` VALUES('',$itemidsearch2,$userid,$quantitysearch2) "); change to... item_add($userid, $itemidsearch2, $quantitysearch2); do the same thing to all inventory inserting queries. but make sure your changing the $itemidsearch2, $quantitysearch2 to the right ones for that search. the item_add function should be in your global_func.php you do not replace that, keep it as it is... And use the function how I have explained above... Edited January 4, 2012 by lucky3809 Quote
boots Posted January 4, 2012 Author Posted January 4, 2012 Thankyou :) lucky, this noob is learning Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.