Can I allow the database to automatically reset a field at every day?-php Tutorial

Source: Internet
Author: User
Design a hotel reservation website backend. a special room only sells 5 rooms a day. how can I set the number of such rooms in the database to 5 at a certain time every day? Does MYSQL have this function? Write a piece of code to insert the roomNum field and update it every day... design a hotel reservation website backend. a special room only sells 5 rooms a day. how can I set the number of such rooms in the database to 5 at a certain time every day? Does MYSQL have this function? Or write a piece of code to insert the roomNum field to implement the function of updating five of them every day?

Reply content:

Design a hotel reservation website backend. a special room only sells 5 rooms a day. how can I set the number of such rooms in the database to 5 at a certain time every day? Does MYSQL have this function? Or write a piece of code to insert the roomNum field to implement the function of updating five of them every day?

Mysql adds an Event from 5.1.6 to meet your needs.
But we do not recommend that you do this. The first configuration is complicated, and the second maintenance is very troublesome.
Since the website background completely writes a scheduled task, you can reset the field on a daily basis.
The built-in qurtz in SpringFramework can easily execute scheduled tasks.
What are you saying you are using PHP? when I did not say it is okay.

Who said php would not work? Cron is easy to use. do not despiseThe best language in the world:)

There should be a reservation record. you just need to query the number of special rooms that have been ordered in the record of the day.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.