RE: [PHP] Multiple insert question

From: Date: Wed, 13 Sep 2000 04:25:07 +0000
Subject: RE: [PHP] Multiple insert question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16489@lists.php.net to get a copy of this message
On Wed, 13 Sep 2000, PHP List wrote: > > >basically, you'll probably have to use a while loop to insert the > information changing the vars every time. > > > >ie. > >while ($row = mysql_fetch_row($resultset)) { > > list($name) = $row; > >$isql = "insert into table (field1,field2,field3,field4,field5,field6) > >values > >('$name','$value1','$value2','$value3','$value4','$value5')"; > >mysql_db_query($dbname,$isql,$db); > >} > > Hello thanks for the reply. I think this will work, but I need a little > more guidance. My first page is where I pull the name# information from > table1. I then use those values to populate a form and add form names of > value1 - value5. > > So the above information is posted to another PHP page that will do the > actual inserts. So the "while($row=mysql_fetch_row($resultset)) {... has > already been done on the previous page. My question is...what would the > while loop look like since I will not be pulling any information from the > db? I already have all the values in the previous page. The problem is > that the variables only give the values for the first "row". > > In case my original post is helpful > http://marc.theaimsgroup.com/?l=php-general&m=96871332800855&w=2)þ > ES‰9+‹“/ÔéB > > TIA, > > Scott I think what you want is to put the values into arrays, serialize() them, pass the serialized version to the next script, unserialize() it into an array and then use list and each to loop through the array to get each of the elements. I think? -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#16489) next »