Re: can I do this: update table while selecting data from table?
| From: | Rafael | Date: | Wed, 14 Jun 2006 21:56:10 +0000 |
| Subject: | Re: can I do this: update table while selecting data from table? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238014@lists.php.net to get a copy of this message | ||
As far as *I* know, yes, the SELECT statement is excuted at that particular moment, and any further execution will be independant of your initial (SELECT) query. Was there any problem?
afan@afan.net wrote:
Am I allowde to do this:
$query = mysql_query("SELECT member_id, member_name FROM members");
while($result = mysql_fetch_array($query))
{
if(empty($result['member_name']))
{
mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
".$result['member_id']."");
}
}
As far as I know, after "SELECT" query, data are in buffer and I AM able
to connect to the same table and do UPDATE, right?
Thanks
-afan
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña