Multiple Inserts With PHP
| From: | Phillip S. Baker | Date: | Wed, 18 Oct 2000 16:56:06 +0000 |
| Subject: | Multiple Inserts With PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20926@lists.php.net to get a copy of this message | ||
Greetings Folks,
I have a form with a drop down list. The user can select multiple options from the list and of course the options get plugged into an array.
Now what I want to know is how to take the information from the array and make multiple inserts into a MySQL table.
So I would have an array with the following values.
A
B
C
And I want each to insert as a different record in a table so in the table it would be inserted as
id value
1 A
2 B
3 C
Now I am suspecting that I need to use some sort of do...while or for loop loop that would pull the first value from the array and run an insert statement in the DB, then increment the place the array by one and run again. But my brain is not figuring out how exactly this would be written. Can anyone help me out?