Re: SELECT?

From: Date: Wed, 28 Dec 2005 12:25:27 +0000
Subject: Re: SELECT?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227922@lists.php.net to get a copy of this message
Hi, As there are only 500 rows, there is not any harm in fetching all records through one query and then do the update between while loop $query="select * from table"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { $newquery="update YOUR STATEMENT where uniquefield like $row['uniquefield']"; mysql_query($newquery); } if you really need to fetch only one record at a time, you can use the LIMIT keyword in your SQL statement, and can create the script as needed. Zareef Ahmed ----- Original Message ----- From: "Christian Ista" <ml@cista.be> To: "'William Stokes'" <kalles@operamail.com>; <php-general@lists.php.net> Sent: Wednesday, December 28, 2005 3:57 AM Subject: RE: [PHP] SELECT? > > From: William Stokes [mailto:kalles@operamail.com] > > I have one MySQL table with about 500 rows. I need to read the table one > > row at a time, make some changes to data in one field and then store the > > changed data to another table. > > 1. May be add a column, CHANGED_FL with default value N. > 2. Select to find the ID minimum with a select CHANGED_FL is N > 3. Select the row with the ID found above and make you business > 4. Make change and change CHANGED_FL to Y > > Repeat operation 2 to 4 > > C. > ==================================================== PHP Expert Consultancy in Development http://www.indiaphp.com Yahoo! : consultant_php MSN : consultancy@indiaphp.com > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#227922) next »