欢迎光临
我们一直在努力

制作我们自己的Ebay(拍卖系统EN) – Managing Bids – Page 5

建站超值云服务器,限时71元/月

this is the complex part – you must make sure everyones bids are correct, update those that have proxy bids, reallocate lots to winners, notify buyers who have been outbid, and perform some upkeep.

first lets look at the code to add a bid.

function dobid(itemid, bidderid, price, optional maxprice, optional maxitems)

set variables and create objects

strconnectionstring = "dsn=myauction;uid=username;pwd=password;database=myauctiondb"

set rst = server.createobject("adodb.recordset")

check to see if a bid already exists for this buyer and auction

strsql = "select bid from tblauctionbids where iid = " & itemid & " and " & _

"uid = " & bidderid

rst.open strsql, strconnectionstring

if rst.eof then a bid does not exist

rst.close

insert info into table

strsql = "insert into tblauctionbids (iid, uid, winprice, maxbid, " & _

"biditems, winitems, time values (" & itemid & ", " & bidderid & _

", " & price & ", " & maxprice & ", " & maxitems & _

", 0, " & now() & ")"

default winitems to 0 for now

else a bid does exist

rst.close

update info in table

strsql = "update tblauctionbids set winprice = " & price & _

" where iid = " & itemid & " and uid = " & bidderid

end if

rst.open strsql, strconnectionstring

fix bidding information

call resolvebids(itemid)

end function

note: this code above is developed for visual basic, and the keyword "optional" in the function opener is not supported in vbscript. in an asp then, simply leave out the keyword "optional" here, and when you call the function, pass in an empty string, i.e.:

call dobid(itemid, bidderid, price, "", "")

this function basically takes some info, and either inserts it or updates it in the bids table – fairly simple stuff. the function resolvebids however is where all the good stuff happens.

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 制作我们自己的Ebay(拍卖系统EN) – Managing Bids – Page 5
分享到: 更多 (0)