Re: Newbie: Update Multiple Records

From: Date: Sat, 17 Aug 2002 03:58:00 +0000
Subject: Re: Newbie: Update Multiple Records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113050@lists.php.net to get a copy of this message
Hi, Print out your data onto a master page, with checkboxes. The checkboxes should be an array, with the ID (or some other unique identifier) of each row. The array would look something like: $approve['1'] => 'Y'; $approve['2'] => 'Y'; $approve['3'] => 'Y'; ... $approve['10'] => 'Y'; The array will only contain rows which were checked. Then on the next page, you loop through the array with a foreach statement, updating the table to suit: foreach($approve as $k => $v) { $sql = "UPDATE .... WHERE id='{$k}'"; $result = mysql_query($sql); } Hope this is enough to get you started. Justin French on 17/08/02 1:37 PM, Lists (lists@coning.com) wrote: > Hi everyone, > > I'm a newbie. I've been searching google and php.net trying to find > information on how to set up a Master Page to do multiple records updating, > but have found very little. I have a table with 10 rows of data from MySQL > and I'd like the user to check the "Approve" checkbox and for as many as he > wants to approve and then click "Submit". > > If someone could point me in the right direction, I'd greatly appreciate it! > > Thanks, Doug >

« previous php.general (#113050) next »