Mysql how do i mass upload data

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
baabaashep
Forum Newbie
Posts: 3
Joined: Sat May 30, 2009 8:21 am

Mysql how do i mass upload data

Post by baabaashep »

OK I'm on basic newbie level here so pls bear with me....
I am trying to think this through before I start and I need some help

I'll cut this down to get to them point

I am going to make a "Property listing Database" here are the two table I will ask about:

table 1: User details
table 2: property details

As Admin I want to be able to upoad 50 new users (on their behalf bypassing the user) with a given username and password (users need to be registered before they can add a property. I then want to upload their 50 property details

I can them simply e-mail the user with their login details and their property will already be in there

Is this possible via csv or something like that?
I think it's a Mass upload solution I need but many will know better than me

Any help would be appreciated
Pete
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Mysql how do i mass upload data

Post by josh »

for 50 records which is laughably small data just use phpmyadmin's import feature. For large databases like 50 million .zip up your mysql data dir and unzip it on the target server
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Mysql how do i mass upload data

Post by califdon »

If you have the availability of phpmyadmin, Josh has suggested the easiest solution. In case you don't, you may want to look at the SQL command LOAD DATA INFILE. As he said, the choice of method for loading batches of data depends on how much data you have and in what format it already exists. There are several methods that could be used under different circumstances.
baabaashep
Forum Newbie
Posts: 3
Joined: Sat May 30, 2009 8:21 am

Re: Mysql how do i mass upload data

Post by baabaashep »

Thanks for the input
The number of records isn't important.

I think I may actually be looking for help on a script(php perhaps?) that will allow the upload of data via a csv file actually

I want an idiot proof way of uploading data to the db - for the user as well. Perhaps online through a php form or script to the db?
All the user should have to do is complete the csv file, press upload and all the properties will upload(as opposed to them inputting one at a time) to the db

I hope I am I making sense here ..... :?
any help appreciated...
Thanks
Pete
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Mysql how do i mass upload data

Post by califdon »

There is no such thing as idiot proof. The more automatic you make it, the worse the problems become when something goes wrong with the CSV format, because you are not there to handle the problem. But if you have a stable, reliable way to create the CSV file, then the script is easy, that's why I referred you to the LOAD DATA INFILE command.
baabaashep
Forum Newbie
Posts: 3
Joined: Sat May 30, 2009 8:21 am

Re: Mysql how do i mass upload data

Post by baabaashep »

Thanks
I will need to look this up

Pete
Post Reply