Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 14th July 2012, 11:36
Ahad Ahad is offline
Junior Member
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need php script for insert data in mysql from text file

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.
Attached Files
File Type: txt cdr.txt (3.7 KB, 204 views)
Reply With Quote
Sponsored Links
Old 15th July 2012, 13:55
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts

You can search for "csv to sql" on Google, there are a lot of scripts and online tools.
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Old 17th August 2012, 20:49
dannypb dannypb is offline
Junior Member
Join Date: Oct 2011
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts

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!


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
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combination of postfix and courier failing Xaymar Server Operation 3 7th March 2012 18:28
issues in /var/log/apache2/error.log denpark Installation/Configuration 1 22nd November 2011 10:12
ISPConfig Autoresponder, adding subdomain problem BlackHat Installation/Configuration 4 18th October 2011 15:24
All my mail is going to /var/mail/vmail _sluimers_ Installation/Configuration 21 10th January 2011 14:21
rkhunter report Captain Installation/Configuration 6 10th October 2010 14:05

All times are GMT +2. The time now is 12:02.

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