Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JS help needed (Auction Site)

    I'm trying to create an online auction site, most of the pages are complete. I decided to start working on the functionality for the bidding page and did a rough sketch of what would be taking place on this page. Sadly I am a total newbie to JS and I have no idea how to accomplish what I wish to get done. Any help would be greatly appreciated.

    Here's my logic thus far (this would all occur when a user clicks on the 'Bid' button' :

    next_bid = current_bid + bid_increment

    If bid_amt < next_bid
    Error msg "Your bid MUST be greater than or equal to the next bid amount " + next_bid " ."

    Else {
    Msg "Are you sure you want to bid " + bid_amt " ?"
    If selected = YES
    If current_time > end_time
    auct_status = Closed
    Update tbl_auction {auction_status}
    Msg "Sorry, this auction is closed."
    Else
    current_bid = bid_amt
    bid_time = current time
    Insert into tbl_bid {bid_amt, bid_time, bid_date,

    username}
    Update auction {current_bid}
    Msg "Bid successful"
    End If

    End If
    End If


    NB. I am using Mysql for my database and my pages are all php.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,151
    Thanks
    80
    Thanked 4,557 Times in 4,521 Posts
    Since very little of the code you show there *COULD* be in JavaScript, maybe you should (for starters) forget JS and just code in PHP. Later, when the PHP works, you could maybe enhance it with JS. But start with PHP.

    You should also look around and see if you can't find pre-written code, rather than re-inventing the wheel. I don't use PHP, but I know there are *TONS* of available code in other server-side systems. Surely ditto in PHP.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good advice. I shall do it all in PHP then enhance with JS after. Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •