473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

upload a csv into a database

I have had a quick look on the net for the above but have found a load of
impressive scripts, all of whic are too over complicated for what i need to
do:

I have a csv file of number plateswith fixed column headings that i want to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name
the database structure is of similar format

How do i acheive this?

Any help would be grateful
Craig
Jul 17 '05 #1
5 5605
Craig Keightley wrote:
I have had a quick look on the net for the above but have found a load
of impressive scripts, all of whic are too over complicated for what i
need to do:

I have a csv file of number plateswith fixed column headings that i
want to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name
the database structure is of similar format

How do i acheive this?


You can use phpMyAdmin (http://phpmyadmin.sourceforge.net) which is a
web based interface to the database. When you view a table's properties
there's an "Insert data from a textfile into table" option at the
bottom of the page which lets you specify all sort of parameters about
the file you are to import.

From the command line there's the mysqlimport utility.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2
Craig Keightley wrote:
I have had a quick look on the net for the above but have found a load of
impressive scripts, all of whic are too over complicated for what i need to
do:

I have a csv file of number plateswith fixed column headings that i want to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name
the database structure is of similar format

How do i acheive this?

Any help would be grateful
Craig

Upload the file, fopen it then use fgetcsv to read through the file line
by line and create an array of all the columns. Insert those into the
database. et voila.

http://www.php.net/manual/en/function.fgetcsv.php

Sacs
Jul 17 '05 #3
Thanks but I know about phpMyAdmin and use it on a daily basis. This will be
for a client of mine (needs to be idiot proof) who will upload there own csv
files

Thanks anyway though

Craig
"Chris Hope" <bl*******@electrictoolbox.com> wrote in message
news:11**************@216.128.74.129...
Craig Keightley wrote:
I have had a quick look on the net for the above but have found a load
of impressive scripts, all of whic are too over complicated for what i
need to do:

I have a csv file of number plateswith fixed column headings that i
want to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name
the database structure is of similar format

How do i acheive this?


You can use phpMyAdmin (http://phpmyadmin.sourceforge.net) which is a
web based interface to the database. When you view a table's properties
there's an "Insert data from a textfile into table" option at the
bottom of the page which lets you specify all sort of parameters about
the file you are to import.

From the command line there's the mysqlimport utility.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

Jul 17 '05 #4
"Craig Keightley" <do**@spam.me> wrote in message news:<41***********************@news-text.dial.pipex.com>...
I have had a quick look on the net for the above but have found a load of
impressive scripts, all of whic are too over complicated for what i need to
do:

I have a csv file of number plateswith fixed column headings that i want to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name


LOAD DATA INFILE <http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html>
Look at comment #4964

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com
Jul 17 '05 #5
Thats a great way. I knew from looking at the code generated by phpmy admin,
it was along these lines but this works great

Thanks to all

craig
"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in message
news:ab**************************@posting.google.c om...
"Craig Keightley" <do**@spam.me> wrote in message
news:<41***********************@news-text.dial.pipex.com>...
I have had a quick look on the net for the above but have found a load of
impressive scripts, all of whic are too over complicated for what i need
to
do:

I have a csv file of number plateswith fixed column headings that i want
to
be able to upload via a web interface.
Once loaded, i want it to insert the values into a database.

CSV data:

Registration number New style (Y/N) Price Matches
xx123 N 14995.00 match name


LOAD DATA INFILE <http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html>
Look at comment #4964

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2408
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
4
9905
by: weiwei | last post by:
Hi All I want to upload either image or word document into either access or SQL server database so far I am doing some small testings and what I can do is upload the file from first page and...
5
3236
by: bob garbados | last post by:
I am trying to create a database-driven photo gallery for a friend with an admin form to upload images... I can upload a file to the web server, but I want to store the image in a database and I...
0
4737
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
3815
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
6
3031
by: Vic Spainhower | last post by:
Hello, I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both...
2
7627
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
3
613
by: shapper | last post by:
Hello, I need to upload a file. Can I only do this with the File Upload control? I also need the following: - Send upload info, upload percentage, continuously to a JavaScript function so...
0
2654
by: ll | last post by:
I'm working with 'pure ASP upload' script which is designed to redirect to an alert/error message, should a file larger than the set limit be attempted to be uploaded. The problem is that, while...
4
4854
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.