开发者

import text file into mysql using jquery

i want to import .txt file values into mysql using php and jquery/Ajax without page refresh.

with following format.

for example text file is :

       user@emaill;user name;gender
       user1@emaill;user name;gender
       user2@emaill;user name;gender

user select file and press Process Button. once it start processing JQUERY/AJAX shows

      you have 3 records
      processing Record no.1 user@email
      ..................................
      ..................................
      Import Process Complete

does any one work on same example.

i search on net but didn't find any example. many examples for picture upload but not f开发者_开发百科or import data from text file.

Thanks


Forget about jQuery. I don't see it playing any role at all for this job.

Just do a POST to send the data to your PHP script. There, let PHP write it to a file and do LOAD DATA INFILE (http://dev.mysql.com/doc/refman/5.1/en/load-data.html).

Altertnatively, if you don't want to copy the data to a file, use fgetcsv() (http://nl2.php.net/manual/en/function.fgetcsv.php) to parse the lines and fields, and generate SQL statements so you can store it in MySQL

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜