Re: Multiple Inserts With PHP

From: Date: Thu, 19 Oct 2000 11:00:42 +0000
Subject: Re: Multiple Inserts With PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21138@lists.php.net to get a copy of this message
I use postgresql, so I don't know command syntax for mysql, but the code is very similar. for($i=0; $i < sizeof($array_of_data); $i++) { $query = "insert into table values('".$array_of_data[$i]."')"; $result = pg_exec($connection,$query); } Hope this helps, Roberto Cespa "Phillip S. Baker" wrote: > 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? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Colombo2000 http://www.colombo2000.it Il tuo prossimo viaggio comincia qui +---------------------------------------------+ | Roberto Cespa | | Responsabile Ricerca e Sviluppo Colombo2000 | | Email: rcespa@colombo2000.it | | Mobile: +39-380-3042732 | +---------------------------------------------+

« previous php.general (#21138) next »