Re: update one column in many records?

From: Date: Wed, 11 Oct 2000 16:21:22 +0000
Subject: Re: update one column in many records?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-19624@lists.php.net to get a copy of this message
I have found the answer in looking back through this list. Should have been more thorough the first time. I modified and use the lines which were taken from the list as: //$change_stat = sprintf ("<INPUT TYPE=\"text\" NAME=\"status[]\"", $row["id"]); //$change_stat .= sprintf (" VALUE=\"%s\" DEFAULT=\"%s\" SIZE=\"5\"><BR>",$row["status"], $row["status"]); Many thanks for the responses. Floyd On Wed, 11 Oct 2000 10:37:37 -0400, you wrote: > >Daniel > >Sorry. Sometimes I try to be *too* concise. > >We have a table with two columns. Names and scores. >Routinely we put the current scores in place. >I have a one-record-at-a-time routine but its a drag. It would be nicer to >list all the names with their associated form input boxes alongside, on the >screen at one time, then input all the new scores and then submit everything >with one button click. > >The name list tends to grow so that its best perhaps to create the list on the >fly. I did such a dynamic listing but have not seen how to keep the multiple >input boxes viably separate so as to pick them up again for re-entry to the >table. It is not so much inputting to the table but rather the creation of >$ID_array_from_form. > >I'm a beginner at arrays but think they would be necessary here to save a lot of >scripting. Besides, I need to get started on arrays too. ;-) > >Thanks for your suggestions. > >Floyd > >On Wed, 11 Oct 2000 00:46:18 -0400, you wrote: > >>Hey Floyd: >> >> >>> I need to update one element of a record, in many records. I would like to do >>> this all at one time from a screen with a column of input boxes. Is this >>> possible with arrays? Perhaps one that reads a column instead of a row? >> >>Your question is extremely vague. This most likely has to do with properly >>writing one SQL statement, for example: >> >> update tablename set colname='$newvalue' where colname='$oldvalue' >>or >> $in = implode(",", $ID_array_from_form); >> update tablename set colname='$newvalue' where id in ($in) >> >>--Dan >> >>-- >> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y >> More than just answers. Solutions. (SM) >> http://www.analysisandsolutions.com/ >> 4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 > >-- --

« previous php.general (#19624) next »