Current location: Hot Scripts Forums » Programming Languages » PHP » PHP does NOT update the mysql when rapidly sent through browser - $20 REWARD PAYPAL


PHP does NOT update the mysql when rapidly sent through browser - $20 REWARD PAYPAL

Reply
  #1 (permalink)  
Old 04-21-06, 02:06 PM
billyspcs billyspcs is offline
Newbie Coder
 
Join Date: May 2005
Location: NY
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
PHP does NOT update the mysql when rapidly sent through browser - $20 REWARD PAYPAL

Hello All,

I need some help with my PHP scripts... and yes the first person who can help me solve the problem will receive 20 dollars through PayPal.

The Problem:

I own an online browser/PHP based game. (Booyacasha.com) Players can create an account and build-up their characters in a fictional world. Well, in this game players can take items and place them up for auction > which is handled all through PHP and MYSQL. Every item on the game has it's own unique id #, so if a player has that item, they simply have that id # stored in the mysql database in the same row as their username. Each players items are account info are stored in a table that looks like this: Username | Password | item1 | item2 | item3 | ...to item20

...so when they place an item up for auction my script does the following:
1) The script receives the item id # through $id = $_POST['id'];
2) Selects the row from the table of Users shown above where the username == to their username and stores it as a variable ($account)
3) then the script checks each of the $account array's elements (item1 > item20) to see if the item id # == to any of the columns (This shows if they truly have the item they are trying to auction)
4) if true ($account[item1-20] == $id) then they have the item and I take it away, by setting $account[item1-20] = ' '
5) Now i place the item in the auction by inserting into a table called 'Auction' with the values (' ID KEY ', '$username', '$id')
6) then they are sent through header("Location to the auction PHP page


...so the big problem, when a user clicks on the Auction Item button really quick the script somehow doesn't catch that the item has already been given. It is as if the script does the insert into the Auction table but never updates the Account table...

Again I will pay 20 dollars for the solution to this problem, and I have the script availible upon request.

PLEASE email support@booyacasha.com with any ideas, I will not be checking this post.

Thanks,
Bill
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-21-06, 06:32 PM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Well, the page would have to reload completely each time the item is sent, so if the user presses it rapidly, not allowing the page to reload, then it will cancel the script request and not complete the transaction

Maybe try using javascript to get each time the button is clicked and make a que and process them..
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 04-22-06, 02:56 PM
Barnz1986 Barnz1986 is offline
Aspiring Coder
 
Join Date: Jan 2006
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by billyspcs
Hello All,

I need some help with my PHP scripts... and yes the first person who can help me solve the problem will receive 20 dollars through PayPal.

The Problem:

I own an online browser/PHP based game. (Booyacasha.com) Players can create an account and build-up their characters in a fictional world. Well, in this game players can take items and place them up for auction > which is handled all through PHP and MYSQL. Every item on the game has it's own unique id #, so if a player has that item, they simply have that id # stored in the mysql database in the same row as their username. Each players items are account info are stored in a table that looks like this: Username | Password | item1 | item2 | item3 | ...to item20

...so when they place an item up for auction my script does the following:
1) The script receives the item id # through $id = $_POST['id'];
2) Selects the row from the table of Users shown above where the username == to their username and stores it as a variable ($account)
3) then the script checks each of the $account array's elements (item1 > item20) to see if the item id # == to any of the columns (This shows if they truly have the item they are trying to auction)
4) if true ($account[item1-20] == $id) then they have the item and I take it away, by setting $account[item1-20] = ' '
5) Now i place the item in the auction by inserting into a table called 'Auction' with the values (' ID KEY ', '$username', '$id')
6) then they are sent through header("Location to the auction PHP page


...so the big problem, when a user clicks on the Auction Item button really quick the script somehow doesn't catch that the item has already been given. It is as if the script does the insert into the Auction table but never updates the Account table...

Again I will pay 20 dollars for the solution to this problem, and I have the script availible upon request.

PLEASE email support@booyacasha.com with any ideas, I will not be checking this post.

Thanks,
Bill
Thats strange, I would have thought it would have been quick enough.

Might have something to do with the HTML being outputted before the insert into the account table has processed.

If all your content is echo`d after the insert then I cant see how this could happen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 02:41 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-25-05 12:09 AM
PHP to MySQL script question...(using a field to update info in MySQL) DisneyFan25863 PHP 4 11-02-03 04:31 AM


All times are GMT -5. The time now is 11:11 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.