Just Ace Posted June 22, 2015 Posted June 22, 2015 Having a huge problem at the moment, I've spent a whole hour trying to solve the problem and so far no luck and I don't know where else is to look. So basically every time I use an item in the Inventory only doing 1 click uses double of the item. The same goes for sending an item too, the input was 1 but sent 2 over. Anybody have any clue what the issue could be? Quote
realmoflegends Posted June 22, 2015 Posted June 22, 2015 Have the section of code? That may help. Quote
Just Ace Posted June 22, 2015 Author Posted June 22, 2015 Have the section of code? That may help. Thats the whole point I don't know where the code is. I've been tweaking loads of files to see where/what it could be. Tried files such as inventory, itemuse, itemsend also tried deleting the items and remaking them and seeing if that would work. Quote
Just Ace Posted June 22, 2015 Author Posted June 22, 2015 Let's see your itemuse code, perhaps. Same as the original MCC V2 - Just with Daves Ajax Donation code in with it too. Tried getting rid of that and seeing if it was a fix, that wasn't an issue. Quote
Just Ace Posted June 22, 2015 Author Posted June 22, 2015 Issue found, it's not the script itself, it's the browser(s) I tried with Chrome & Firefox and the issue is there. I tried over my IPhone & Tablet and there is no issue, so I'm sure it's the browser even after clearing history and caches. Quote
NonStopCoding Posted June 22, 2015 Posted June 22, 2015 Issue found, it's not the script itself, it's the browser(s) I tried with Chrome & Firefox and the issue is there. I tried over my IPhone & Tablet and there is no issue, so I'm sure it's the browser even after clearing history and caches. I can't see why the browser can cause it to send twice are you sure you were not refreshing it or whatever Quote
Just Ace Posted June 22, 2015 Author Posted June 22, 2015 100% certain, Opera seems to work fine though. Quote
Royal Guardian Posted June 22, 2015 Posted June 22, 2015 Hey there, May we see your itemuse.php? Also, your item_add & item_remove function which can be found in the global_func.php. Quote
Uridium Posted June 22, 2015 Posted June 22, 2015 I'm sure somewhere on this forum the issue your having was also raised try doing a search on the forums for multiple item use Quote
lucky3809 Posted June 23, 2015 Posted June 23, 2015 A simple javascript to prevent from refreshing will probably solve this. Quote
SRB Posted June 23, 2015 Posted June 23, 2015 Read up Fellas :-) I would read up again, but the logic is flawed. A browser can't cause the issue, as a whole, it can only cause it as a result of not parsing your code correctly, which still comes down to a problem with the code, so I'm going to go out on a whim and suggest 2 options; 1. You have an extension installed on Firefox which is causing it. 2. As strange as this sounds, your HTML is broken! I recall many years ago having some code run twice and the end result, after a stupid amount of debugging, was an HTML mismatch. Strange indeed and never did quite find out WHY it did it! Quote
Magictallguy Posted June 23, 2015 Posted June 23, 2015 [...] 2. As strange as this sounds, your HTML is broken! I recall many years ago having some code run twice and the end result, after a stupid amount of debugging, was an HTML mismatch. Strange indeed and never did quite find out WHY it did it! To add on to this, I've also ran into this issue for a client. It was a simple DOCTYPE/XHTML issue, (more precisely, a non-self-closing tag that had been written to self-close (i.e. <form action='whatever' method='whatever' />)) Quote
Just Ace Posted June 23, 2015 Author Posted June 23, 2015 A simple javascript to prevent from refreshing will probably solve this. Decided to try this and worked, thanks! Quote
RJDGaming Posted June 24, 2015 Posted June 24, 2015 Decided to try this and worked, thanks! You do realize that JavaScript can be turned off by user request, right? So if the user disables JavaScript, the bug is still there... I'd suggest you find another fix. :eek: Quote
lucky3809 Posted June 24, 2015 Posted June 24, 2015 I mentioned the javascript because most of the time it is not the code at all but the users mouse, clicking too fast can result in 2 clicks at once, resulting in two item used. However other posters may also have a point about html tags being opened, or incorrect document html. IMO, I would just recode items all together instead of adding quantity I would just insert the item for it's own inventory id, and use the mysql count for that item to display the quantity or whatever, and when an item is used that inventory id is deleted, and can't be used again, and to use another item, the user would have to go back to their inventory and click use, ect...just prevents users from double clicking, or refreshing all together. I didn't mention this because it's a bit of an upgrade lol. Quote
KyleMassacre Posted June 24, 2015 Posted June 24, 2015 I mentioned the javascript because most of the time it is not the code at all but the users mouse, clicking too fast can result in 2 clicks at once, resulting in two item used. However other posters may also have a point about html tags being opened, or incorrect document html. IMO, I would just recode items all together instead of adding quantity I would just insert the item for it's own inventory id, and use the mysql count for that item to display the quantity or whatever, and when an item is used that inventory id is deleted, and can't be used again, and to use another item, the user would have to go back to their inventory and click use, ect...just prevents users from double clicking, or refreshing all together. I didn't mention this because it's a bit of an upgrade lol. Maybe I am a bit confused but, to me it seems that your theory would yield the same result. Whether it be an insert or update, the query is being ran more than its supposed to Quote
lucky3809 Posted June 25, 2015 Posted June 25, 2015 Maybe I am a bit confused but, to me it seems that your theory would yield the same result. Whether it be an insert or update, the query is being ran more than its supposed to You are confused, what I meant was when an item is used the item gets deleted per inventory id not item id, how mccodes is when an item is used, item use wise, it is used per item id and goes off quantity. Not inventory id because when you add to the inventory it goes into the quantity and does not insert a new inventory id unless it's an item the user does not have. To put it point blank, to use an example, is the game roguevampires how when you use the item it no longer exist to use a second time, it can only be used once, even if you were to refresh you will get an error that the item no longer exist. As for mccodes you can refresh till you have NO quantity. Quote
KyleMassacre Posted June 25, 2015 Posted June 25, 2015 You are confused, what I meant was when an item is used the item gets deleted per inventory id not item id, how mccodes is when an item is used, item use wise, it is used per item id and goes off quantity. Not inventory id because when you add to the inventory it goes into the quantity and does not insert a new inventory id unless it's an item the user does not have. To put it point blank, to use an example, is the game roguevampires how when you use the item it no longer exist to use a second time, it can only be used once, even if you were to refresh you will get an error that the item no longer exist. As for mccodes you can refresh till you have NO quantity. Ahh gotcha. That makes more sense but I believe it would be less efficient that way. 1 row holding a quantity of 1000 of an item is less storage space than 1000 rows holding a quantity of 1 item. That is a lot of bits of data to store considering your structure looks like this: inv_id, item_id, userid, quantity. For arguments sake let's say 1 row hold 5 bits of data to hold an item with 5 in the quantity. That would only be 5 bits of data stored for that particular item. If the user had a quantity of 5 your way that would be 25 bits of data. Note that I am not an expert on how much storage it actually would be but a database is essentially a file and the more characters in the file the bigger the file is. Same concept 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.