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" <[EMAIL PROTECTED]>
To: "'William Stokes'" <[EMAIL PROTECTED]>; <php-general@lists.php.net>
Sent: Wednesday, December 28, 2005 3:57 AM
Subject: RE: [PHP] SELECT?


> > From: William Stokes [mailto:[EMAIL PROTECTED]
> > 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 : [EMAIL PROTECTED]

> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to