Foreach-php the regular expression of the imported text file extracts some content into an array and then deposits it into the MySQL database

Source: Internet
Author: User
Tags php regular expression
To use a PHP regular expression to read the following text file, read the Date,time and add the current year as written: 2013-07-03 17:22, there is a NMBR phone number read out, and generate a loop of MySQL statements coexist into the MySQL database.

RINGRINGDATE = 0703 TIME = 1722NMBR = 13332415858RINGRINGDATE = 0704 TIME = 0812 NMBR = 04124834444RINGRING

Become:

insert into calllog (datetime,phonenumber ) values ('2013-07-03 17:22','13332415858');insert into calllog (datetime,phonenumber ) values ('2013-07-04 08:12','04124834444');

Reply content:

To use a PHP regular expression to read the following text file, read the Date,time and add the current year as written: 2013-07-03 17:22, there is a NMBR phone number read out, and generate a loop of MySQL statements coexist into the MySQL database.

RINGRINGDATE = 0703 TIME = 1722NMBR = 13332415858RINGRINGDATE = 0704 TIME = 0812 NMBR = 04124834444RINGRING

Become:

insert into calllog (datetime,phonenumber ) values ('2013-07-03 17:22','13332415858');insert into calllog (datetime,phonenumber ) values ('2013-07-04 08:12','04124834444');


  
   
  • Related Article

    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.