www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] PHP, MySQL Update from Client.

  1. #1
    Join Date
    Mar 2007
    Location
    Cotswolds, England
    Posts
    105

    resolved [RESOLVED] PHP, MySQL Update from Client.

    Hi and Sorry in advance.

    I think I know the answer, but I just want to be 100% certain

    Problem:
    We have a PHP created webpage with an on-going Cost and an Available Options dropdown box. Each Available Option has a cost associated with it. The Cost is temporarily held in a MySQL database until the checkout phase.
    My Boss wants the display of the Cost to be updated when the Available Options box value has been changed, all this without the webpage being refreshed in the browser, i.e. just the Cost value is updated from the MySQL database with the additional Available Option cost.

    I am assuming that the only way is the AJAX route, is this correct, or is there a better solution?

    Thanks and huge appologies again,

    Barton.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,925
    It could be done purely via JavaScript. This would require that you provide all the necessary JS data during the initial page load in order for the JS to do the logic/math to adjust the price as options are changed. As to which is better (AJAX or JS-only), part of the answer might be how much data would need to be downloaded to the browser: a couple kilobytes, no big deal; a couple megabytes, big deal.

    PS: Whichever approach you take, remember not to trust any price calculated on the browser side, as that can easily be changed by a hacker. You'll still have to recalculate it on the server side based on the quantity, options, item ID, etc. that the user selected.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Mar 2007
    Location
    Cotswolds, England
    Posts
    105

    Exclamation

    Many thanks for the prompt reply...

    We only process the options selected, but the price is for the clients to view. Refresh is a none starter as it's an 'expensive objects' website. Refresh screen would not be acceptable to my Boss for a changing price

    Size-wise, very image and flash centric , relatively slow load.

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles