473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HELP. Multi-Record Insert

Hello,

I hope some one can help me, at least give me a little direction.

I have the need to insert many records into the same table at once.
Not very many data points (<5), but many (30+) records. Not being a
PHP guru, I am at a loss as where to start. Really I am a PHP
neophyte. Though I am a quick study and REALLY need to know how to do
this.

Please Help!

Thanks!

Dec 8 '05 #1
3 1417
Fu*************@gmail.com wrote:
Hello,

I hope some one can help me, at least give me a little direction.

I have the need to insert many records into the same table at once.
Not very many data points (<5), but many (30+) records. Not being a
PHP guru, I am at a loss as where to start. Really I am a PHP
neophyte. Though I am a quick study and REALLY need to know how to do
this.


Make one insert for each SQL line you want to insert, this way you can track
what went wrong if something would go wrong.

Of course you can use the ; to make a really long SQL statement, but you will
_NOT_ be able to find out what went wrong if something goes wrong.
INSERT INTO table(user,age) VALUE('tom','10'); INSERT INTO table(user,age)
VALUE('ann','11')

If you do not know how to use sql from PHP, then you should take a look at the
following page (assuming you are using mysql):
http://www.php.net/manual/en/ref.mysql.php
//Aho
Dec 8 '05 #2
INSERT INTO `graph_apps` (`app_id`,`name`) VALUES

(1,'cities'),

(2,'statemachine'),

(3,'molecules'),

(4,'prj_mgmt');

One insert statement. Use commas. As I saw in a previous post, there is a
30-second limit probably imposd on the server, and a 1MB query limit also
probably imposed on the server. If its your own box, you can probably tweak
that out.

<Fu*************@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hello,

I hope some one can help me, at least give me a little direction.

I have the need to insert many records into the same table at once.
Not very many data points (<5), but many (30+) records. Not being a
PHP guru, I am at a loss as where to start. Really I am a PHP
neophyte. Though I am a quick study and REALLY need to know how to do
this.

Please Help!

Thanks!

Jan 3 '06 #3
The php timeout can be set with set_time_limit if the server is not
running in secure mode. I didn't see a time limit on MySQL.

Jim Michaels wrote:
INSERT INTO `graph_apps` (`app_id`,`name`) VALUES

(1,'cities'),

(2,'statemachine'),

(3,'molecules'),

(4,'prj_mgmt');

One insert statement. Use commas. As I saw in a previous post, there is a
30-second limit probably imposd on the server, and a 1MB query limit also
probably imposed on the server. If its your own box, you can probably tweak
that out.

<Fu*************@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hello,

I hope some one can help me, at least give me a little direction.

I have the need to insert many records into the same table at once.
Not very many data points (<5), but many (30+) records. Not being a
PHP guru, I am at a loss as where to start. Really I am a PHP
neophyte. Though I am a quick study and REALLY need to know how to do
this.

Please Help!

Thanks!


Jan 3 '06 #4

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

Similar topics

1
by: Silver | last post by:
Hi everyone, my program compiles and executes, but I get an error during run-time. I guess it has something to do with memory allocation (which I don't seem to fully control yet).. Here's the...
7
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) ...
0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
4
by: keepyourstupidspam | last post by:
Anyone know of a reliable design for a Windows C++ Task Scheduler Class. The scheduler will expose a member function that will add schedules, its parameters will be an interval to run the tasks...
1
by: Wade Beasley | last post by:
I have developed a Windows Forms application with C#. On the windows form I have a master list box with the names of people the user can select from and when selected it calls a Select in SQL...
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
5
by: Olly | last post by:
Hello Everyone! Could someone please have a look at my JS Form I posted below....Something wrong there, but I don't understand what's exactly. Many thanks. Olly ...
2
by: deezle | last post by:
Hello, I am trying to get my calculator GUI to +,-,* and /. I have got all of them to work except my division. I was wondering if someone could helpme figure out the problem. Any input would help...
0
by: Kevin McKinley | last post by:
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with...
0
by: Guilherme Polo | last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote: Come on.. "help on lines 384-403", that is not a good way to look for help. You are supposed to post some minimal code that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.