Access database instance one of the ways to import MySQL into an Access database

Source: Internet
Author: User
If you can not import and export between different databases, then it would be a terrible thing, fortunately, the general situation through different methods and approaches, can be achieved, there are a variety of methods, I provide one of them, to provide a treatment of their own ideas, is intended to stimulate,
The first step: first, the Access database with its own export capabilities, to customize a format easy to manipulate the TXT text document, which is related to the next step of the key.
Step two: First build a table of the same structure in MySQL (of course, this step can be implemented in the third step, because of the haste, I could not complete, sorry)
The third step: that is, the programming of their own, to find ways to export the file with the program to read each record and write to the MySQL data table,
$row = File ("Ipadress.txt"); Read the contents of the file into an array
$num =count ($row);//The total number of records in the statistics table
mysql_connect ("localhost", "root", "");//Connect to Database
mysql_select_db ("CHT");
for ($i =0; $i < $num; $i + +)//start Importing Records
{
$fields =explode (",", $row [$i]);
echo $fields [0];
echo $fields [1];
Echo $fields [2];
mysql_query ("INSERT into IPAddress (area_h,area_f,address) VALUES (' $fields [0] ', ' $fields [1] ', ' $fields [2] ')");
}
echo "Imported successfully! A total of $num records are imported, ";
The above operation I is for from the Internet under an IP address comparison of the operation, interested can try,

The above describes the Access database instance Access database one of the ways to import MySQL, including the Access database instance content, I hope to be interested in PHP tutorial friends helpful.

  • 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.