473,606 Members | 2,825 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 5612
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*******@elec trictoolbox.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**********@r ediffmail.com> wrote in message
news:ab******** *************** ***@posting.goo gle.com...
"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
2415
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 and images offline and then send them online... but i have a problem regarding the images i want it to be sent to the web site So i want if there is a possible way to fill data offline and
4
9910
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 display at the next page with (both image or word are working fine). however, I cann't insert them into the database, Plus, what type should I use in access database? anyone who has this type of project, please help me out below is my current test...
5
3241
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 want to resize the image before I save it... How do I take the uploaded .jpg and shrink it to a thumbnail? How do I pass the uploaded .jpg to a stored procedure that will store the image as an image datatype in SQL Server 2000? I'm developing this...
0
4746
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 verdiği hata şu.Bilen arkadaşlar lütfen yardım edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. /classifieds/upload.asp, line 250
9
3823
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 site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
6
3035
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 cases the file is being transmitted to the same FTP server and using the same PHP script so it shouldn't be a file size or login credentials problem. Could someone please help me out and give me some ideas what is wrong. I would really...
2
7642
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 don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in the db-file-to-disk.asp file, what I want to do is the user has to field out this fied before...
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 I can display the Upload Progress.
0
2663
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 smaller files do upload successfully, the script does not catch the larger files and rather than a specific error message in Firefox (and IE7), I just get the following: ------------------------------------ The connection was reset The...
4
4861
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 mydirectory, but for some reason, I am getting different file names on the database. Here is the full code: please do serach on kewword "database" to see where I added my database code - that where I need help with. And here the link where I got it...
0
7981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8127
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8320
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5994
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3952
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2458
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 we have to send another system
0
1315
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.