mysql - Insert data from textfile to a database table -


I want to ask some help from entering data in a database table from texfile .... I have created a php code to execute the file on the table, but I have no luck in importing it ... can anyone know how to do this? Please help me

Enter image details here

Current PHP code: < / P>

  & lt ;? Php $ host = "localhost"; $ User = "root"; $ Pass = ""; $ Db = "clayton"; $ Connect = mysql_connect ($ host, $ user, $ pass); If (! $ Connect) die ("can not connect!"); Mysql_select_db ($ db, $ connect); $ File = fopen ("tblApplicants.txt", "r"); Whereas ($ applicant = fgets ($ file)) Include {$ sql = "TB_Applications (AIC, Name) values ​​('$ applicants')"; Mysql_query ($ sql); }? & Gt;  

Read each row from this file, leave every second line $ i% 2 == 0 break; This "|" Explode and get another ($ line [1]) and the next object ($ line [2]), then trim it, and insert the SQL. Try to do this way


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -