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.
Reply
 
Thread Tools Display Modes
  #1  
Old 14th July 2012, 10: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, 172 views)
Reply With Quote
Sponsored Links
  #2  
Old 15th July 2012, 12:55
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

You can search for "csv to sql" on Google, there are a lot of scripts and online tools.
__________________
Falko
--
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
  #3  
Old 17th August 2012, 19:49
dannypb dannypb is offline
Junior Member
 
Join Date: Oct 2011
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
 
Default

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

Bookmarks

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 17:28
issues in /var/log/apache2/error.log denpark Installation/Configuration 1 22nd November 2011 09:12
ISPConfig 3.0.3.3 Autoresponder, adding subdomain problem BlackHat Installation/Configuration 4 18th October 2011 14:24
All my mail is going to /var/mail/vmail _sluimers_ Installation/Configuration 21 10th January 2011 13:21
rkhunter report Captain Installation/Configuration 6 10th October 2010 13:05


All times are GMT +2. The time now is 10:39.


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