Page 1 of 1

Import csv file in mysql database

Posted: Fri Jul 10, 2009 1:00 am
by biplob
Hi,
I want to write a code in which .csv file can be import and it could be save in MySQL database.I have already created a database called import having table with id,name,size,type content.There shold be page in which we can browse .csv file and be uploaded.After that it could save in sql databse.
Please provide me the complete code.
Thanks in advance..

Re: Import csv file in mysql database

Posted: Fri Jul 10, 2009 1:45 am
by requinix
biplob wrote:Please provide me the complete code.
No. We'll help you but we won't write it for you.

Use fgetcsv to read from the file (after fopening first, of course), build the query, then use mysql_query to execute it.
A loop or two, maybe some fancy array work, and you're done.

Re: Import csv file in mysql database

Posted: Fri Jul 10, 2009 1:48 am
by ddragas
nobody here is going to write code for you, but point you in right direction .......

there are tons of examples on "http instances" how to do it

use functions

fgetcsv
mysql_query

Re: Import csv file in mysql database

Posted: Sat Jul 11, 2009 11:02 am
by peter162in
USE PHPMYADMIN TO IMPORT CSV . IT IS VERY EASY AND SIMPLE RATHER GOING FOR A CODE.

Re: Import csv file in mysql database

Posted: Sat Jul 11, 2009 11:44 am
by califdon
biplob wrote:Please provide me the complete code.
You may have noticed the subtitle of this forum: "The Developer's Network". If you want code written for you, you could post in the Jobs forum here and one of our developers might make a bid for writing it for you.