HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   Need php script for insert data in mysql from text file (http://www.howtoforge.com/forums/showthread.php?t=57932)

Ahad 14th July 2012 11:36

Need php script for insert data in mysql from text file
 
1 Attachment(s)
I need a script which will read data from text file and insert it into mysql database.Please help me if you know the solution.here i attached my text file.

falko 15th July 2012 13:55

You can search for "csv to sql" on Google, there are a lot of scripts and online tools.

dannypb 17th August 2012 20:49

Hey Falko, tysm for all your ispconfig work :) . I recently got it working for my RHEL 6.3 server with your CentOS instructions. You are my hero!

Ahad,

if your server has phpmyadmin, that is one way enter it. With that text file though, you do not give enough information for anyone to enter it into a mysql table. They would need the table name and the fields names. One way you could easily do it yourself, is to cut and paste the insert information into that text file. Then sign into mysql at the command prompt, go to that data base and simply cut and paste the inserts. Here is the general format:

insert into [TABLENAME] ('[FIELDNAME1]', [FIELDNAME2], ect...)
values ('[FIELDDATA1]','[FIELDDATA2]', ect...);

so it would look something like
insert into customertable (cusid, cusname, cusaddress) values ('0', 'Joe', '123 Here St');

the semi colon at the end is needed for every insert. Good luck :)


All times are GMT +2. The time now is 21:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.