Write a PHP document and create a MYSQL table cyclically.

Source: Internet
Author: User
Write a php file, automatically create a MYSQL table cyclically, write a php file at 20 minutes, and automatically create a MYSQL table at intervals of 20 minutes. The table name is defined as table20100531 and table20100601, table20100602 ............................ the table20101231 field is nametext, which writes a php file and automatically creates a MYSQL table cyclically.
Write a php file and create a MYSQL table cyclically.

Table name definition: table20100531, table20100601, table20100602. ............ table20101231

Field: name text date1 int 11

How can I write a cycle for a table created for one year?

------ Solution --------------------
$ T = date ('Y'). '123 ';
For ($ I = 0; I I <366; $ I ++ ){
$ Tabname = 'table'. date ('ymd', strtotime ($ t) + $ I * 86400 );
$ SQL = 'create table $ tabname .....';
Mysql_query ($ SQL );
}

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.