erikperik Posted September 20, 2008 Share Posted September 20, 2008 Hi! I have some problems with a website. The idea is that users bid on items that they want. If no bids have been received for 2 minutes, the auction is closed. So far, so good. I want to build a bid agent so that the users can say "i want to bid at most 25 bids and i want to go as high as X dollars". That means that if noone bids for 2 mins, check bid agents and enter bids from different users with a time difference of 2 minutes until (bidtime+2 mins > servertime) Also to never put 2 following bids from the same user. My way to solve this is to require_once('bidagents.php') on every page. Bidagents.php checks if time for last bid was more than 2 mins ago. If so, select a bidagent (table bidagent includes "username, maxbid, maxnumberofbids, auctionid"). Then iterate and while timeoflastbid was more than 120 seconds ago, bid from a bidagent, update bidagent (decrease maxnumberofbids). This seems very ineffective since I need to iterate through the bidagents and i also get some problems with database not updating until i do a mysql_close(). Also, with many users, it seems unnecessary to check bidagents for every single one, maybe it would be wise to set a updateinterval of 5 seconds or something? (but how...?) Any ideas of how a better idea to solve this? Maybe write the whole thing in Mysql? (The server uses the MyISAM engine) I am very grateful all help I can get! Link to comment https://forums.phpfreaks.com/topic/125059-php-auction-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.