473,471 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

mass INSERT using HTML field, delimiters

7 New Member
What commands do i need to start looking into, to complete a mass insert of info into a database. im looking to insert something like this:

player_name | player_id | location


I want to have a large HTML text field were i can enter multiple lines like this and then have them inserted into the proper tables/fields. Im just looking for a basic theory and commands here so i can start to research and try some simple coding in this area.
Jan 23 '07 #1
4 4453
ronverdonk
4,258 Recognized Expert Specialist
Why HTML? Just use a plain text editor and type your data in there, 1 record per line, fields separated by a char like |.
When finished typing, just issue the MySQL LOAD DATA.. command, such as:
Expand|Select|Wrap|Line Numbers
  1. LOAD DATA INFILE 'test.txt' INTO TABLE test
  2.   FIELDS TERMINATED BY '|'
For further information see the MySQL manual at load data

Ronald :cool:
Jan 23 '07 #2
Motoma
3,237 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO playerTable (player_name, player_id, location)
  2. VALUES
  3.   ('jake',42,'Portland'),
  4.   ('Brak',34,'Los Santos'),
  5.   ('Gil',1,'Springfield')
  6.  
Hope this helps.
Jan 23 '07 #3
Choronzon
7 New Member
why HTML fields? because this database is interacted with via a webpage that is open to any person playing this game, who wishes to store player and locations data. They do not have access to upload .txt files to the server. they would need to make their own .txt file, and copy/paste it to a field.

one question about the LOAD DATA INFILE. I have read up on this commandm, but am not sure were i store the data. were do i put the .txt file? can i put it anywere and point to it with a URL address in the LOAD DATA INFILE command?
Jan 24 '07 #4
ronverdonk
4,258 Recognized Expert Specialist
I am sorry, but I misunderstood the words 'mass insert' in your original post. I had the idea that you wanted thousands of text lines to be inserted at once.

You start with a form that is submitted when completed by the user. Within that form you can let your users enter the required data in a <textarea> HTML field. After completing the input the user submits the form to your processing script. There you could cleanse (very important) and interpret the entered data (such as recognizing and translating separator chars, new-line chars, tabs, etc.). After that you can build an SQL INSERT or UPDATE statement for the data and process that using mysql_ commands in PHP.

As to your latest post:
No must give a path name for the file to upload, no url.
The LOCAL keyword, if specified, is interpreted with respect to the client end of the connection:

If LOCAL is specified, the file is read by the client program on the client host and sent to the server.
If LOCAL is not specified, the file must be located on the server host and is read directly by the server
Ronald :cool:
Jan 24 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ian Griffiths | last post by:
I'm having issues witht the code I'm writing. I've dealt with SQL before, although only for extracting data, not adding it to the database. I've been intensively learning ASP/ADO over the past week...
3
by: jason | last post by:
I need to deposit and empty dummy value into a date/time field within Access using INSERT. However, I pick up a data type error if I attempt to insert a NULL value for this particular date time...
5
by: me | last post by:
I'm also having problems getting the bulk insert to work. I don't know anything about it except what I've gleened from BOL but I'm not seeming to get anywhere...Hopefully there is some little (or...
4
by: Sergio del Amo | last post by:
i, I have the next html page <html> <head> <script> <!-- function insertcode() { var code ="<p> blablabal babala babababab</p><h1>here comes header</h1><span>fadfafa<a...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
10
by: Stefan Richter | last post by:
Hi, I am trying to enter data into a table, but I got problems with my sql statement. It's something like that: Dim now As String = DateTime.Now.ToString INSERT INTO table (date) VALUES(now)...
1
by: zierde01 | last post by:
I read topic the followoing topic: http://www.thescripts.com/forum/thread143458.html and the people attempting to help requested further code/documentation to assist in resolving the problem. I...
1
by: teo | last post by:
Hallo, I'm performing a mass insertion from a text file to a db table with AdoNet commands, like this: myCommand.CommandText = "BULK INSERT ..." from a Win form no problem
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
0
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
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...
0
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
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...
1
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
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
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.