RE: [PHP] Getting the data for MySQL and then putting it back withPHP - at a loss!

From: Date: Fri, 22 Feb 2002 13:46:02 +0000
Subject: RE: [PHP] Getting the data for MySQL and then putting it back withPHP - at a loss!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85848@lists.php.net to get a copy of this message
Yeah, but, where does $rowcount come from, $or? Are you just renaming the variable? Thanks for your help! -Mike > -----Original Message----- > From: george Pitcher [mailto:mandrakephp@yahoo.com] > Sent: Friday, February 22, 2002 7:40 AM > To: Michael Romagnoli > Cc: php-general@lists.php.net > Subject: Re: [PHP] Getting the data for MySQL and then putting it back > withPHP - at a loss! > > > Michael, > > Been there recently! > > You want to use variable variables: > > $index=0; > for (index=0; $index < $rowcount; $index++){ > $formvar='formvar'.$index; > $formvar=$$formvar; > > Do the last two lines for each piece of data you want to handle. > > Think about how you are isolating the formvars on the submitted page to > make sure that you are sure you are reading the right stuff. > > Hope this helps. > > George in Edinburgh > > > > On Fri, 2002-02-22 at 12:24, Michael Romagnoli wrote: > > > > I have a special set of information retrieved from a while loop > that I would > > like a person to be able to edit and send back into a MySQL table. > > > > I know all of the basic MySQL commands for doing such, but the > PHP side to > > get the input from the form to go in is really stumping me. > > > > This is what I have: > > > > --------------------- > > > > $or = 0; > > > > while($or < $orderidrows) { > > > > $orderinfo = mysql_fetch_row($orderidinfo); > > $domain[$or] = $orderinfo[2]; > > $cancel[$or] = $orderinfo[3]; > > > > print "<tr><td><font size=2 face=Arial> > $domain[$or]</font></td><td><font > > size=2 face=Arial>Cancel This Domain?</font></td><td><font size=2 > > face=Arial><input type=text name=confirm value='$cancel[$or]' > > size=3></font></td>"; > > > > $or++; > > } > > > > ---------------------- > > > > The values/data I would normally insert into the MySQL from the > form would be > > $confirm, based on $domain - however, in this case, I have a > number of rows > > with the same > > name. I've received help as far as distinguishing one row from another - > > thanks. :) > > > > The problem I am really having is trying to insert the data > back into one > > particular table. You see, when I select the data, I get multiple > > orderid's with multiple domains attached to them. When I try > to UPDATE the > > MySQL with the data, only the last orderid seems to be the one getting > > updated. And, to boot, I want to update based on the domain name (since > > that is unique) and ignore the orderids. I only used the > orderids to pull > > the data out. > > > > So, I've been using a query like this in a loop; > > > > $update = "UPDATE table2 SET cancel='$cancel[$a]' WHERE domain > = $domain[$a] > > > > Any suggestions? I'm getting pretty desparate here! :\ > > > > Thanks, > > > > -Mike > > > > > > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > >

« previous php.general (#85848) next »