in reply to Re: Inserting Multiple Records in DB.
in thread Inserting Multiple Records in DB.
An INSERT ... VALUES statement inserts only one record per execution. You're collecting your data from a structured file using nested loops, so I doubt that it can be modeled very well with a single database record.
This isn't true at all. In standard-SQL, you can insert multiple rows of data with a single INSERT statement, and if you look at what the "joins" are doing in the OP's code, you'll see that that's what he's doing.
Your other advice sounds about right, though. Using bind parameters (question marks) with prepare is a good habit to get into to guard against SQL-injection attacks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inserting Multiple Records in DB.
by Narveson (Chaplain) on Mar 02, 2008 at 02:09 UTC |