Jump to content
MakeWebGames

Please help search streets


boots

Recommended Posts

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 by boots
added more info
Link to comment
Share on other sites

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 by lucky3809
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...