20 rows of statements are converted from Excel to mysql. Since I had some knowledge of php and mysql, I have been very keen on sharing confidential commercial data with the company's huge Excel database, as I thought about how to get a hand, since I had a certain understanding of php and mysql, I was very impressed with the company's huge Excel database, I want to secretly "share" this confidential commercial data, while thinking about how to get it, while thinking about how to convert it into a mysql database, I went to many php site forums to ask experts, there was no result, why don't you try this method one day? The results are also true. everything is OK. I will share my experience with you (maybe you have a better way)
Shard decomposition:
1) select all records in field a and select "Copy"
Bytes
32.16a.xlsa.txt (format: "text files (tab-separated )")
In the 42.16e.xls, the numbers of other 3 fields are 1 to 3, and B .txt, c.txt, and d.txt are continuously generated.
2. after completing the above steps, you have completed most of the work. The following is done by php and mysql, which is simple:
1) to put data in mysql, you must create a mysql database named dbname (consistent with the dbname in php code), including the table tbname (consistent with the tbname in php code ), the four fields inc char (100), adds char (100), pri char (100), and tel char (100) must be adjusted according to the field size in Excel, otherwise, the part score may be lost.
2) writing php code is the most important. the code is as follows:
------ Txt2mysql. php ---------
$ Inc = file ("a.txt ");
$ Adds = file ("B .txt ");
$ Pri = file ("c.txt ");
$ Tel = file ("d.txt ");
$ I = 0;
Mysql_connect ();
While (strlen ($ inc [$ I])> 0)
{
$ SQL = "insert into tbname values ('$ inc [$ I]', '$ adds [$ I]', '$ pri [$ I]', '$ tel [$ I]') ";
$ Do = mysql_db_query ("dbname", $ SQL );
$ I = $ I + 1;
Echo'
';
}
$ S = "select * from tbname ";
$ Gg = mysql_db_query ("dbname", $ s );
$ N = mysql_num_rows ($ gg );
Mysql_close ();
Echo'
';
Echo "added". $ n. "records ";
?>
Note: a.txt, B .txt,c.txt,d.txt and txt2mysql. php must be in the same directory.
...