Results 1 to 3 of 3

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

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Cotswolds, England

    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

    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,


  2. #2
    Join Date
    Aug 2004
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Mar 2007
    Cotswolds, England


    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.


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