Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote: ?!?!?!?!?!?! I hope youi used str_repeat() to generate that. seriously though, have you tried it? that said your [probably] better off just doing 1 query: UPDATE members SET member_name = 'N/A' WHERE member_name = ''; that said your [probably] better off

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
I wonder why this sarcasm? Why so rude? -afan [EMAIL PROTECTED] wrote: ?!?!?!?!?!?! I hope youi used str_repeat() to generate that. seriously though, have you tried it? that said your [probably] better off just doing 1 query: UPDATE members SET member_name = 'N/A' WHERE

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
Jochem, You are wrong. I tried and it worked. But, when I asked can I, I meant Am I allowed to do that. The same as many security or other kind questions where answer is: Yes, it works - but it's NOT correct. Yes, I did search php.net but didn't find answer. Yes, I did search mysql.com but didn't

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote: You are wrong. there's a first for everything, heh. I tried and it worked. But, when I asked can I, I meant Am I allowed to do that. The same as many security or other kind then say what you mean in future. you already knew that you *can* do it, you should have

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote: I wonder why this sarcasm? Why so rude? your original question could have been answered by: a, trying to run the code provided (thats called testing btw) b, reading php.net c, reading mysql.com/docs (or where ever they have the docs this week) my reply not only

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread tedd
At 4:11 PM +0200 6/15/06, [EMAIL PROTECTED] wrote: Jochem, You are wrong. I tried and it worked. But, when I asked can I, I meant Am I allowed to do that. The same as many security or other kind questions where answer is: Yes, it works - but it's NOT correct. Yes, I did search php.net but didn't

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
Yes, you are right, I had to be more carefull about how to write my post. Thanks. for bruising your ego? or for originally giving 2 suggestions as to better strategies for doing what you *seemed* to be wanting to achieve - 2 suggestions which you blatantly seemed to ignore in favor of

[PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
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

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread Jochem Maas
[EMAIL PROTECTED] 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 =

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread Satyam
member_id, ifnull(member_name,'N/A') FROM members Satyam - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, June 14, 2006 11:37 PM Subject: [PHP] can I do this: update table while selecting data from table? Am I allowde to do this: $query

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
?!?!?!?!?!?! [EMAIL PROTECTED] 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

Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
@lists.php.net Sent: Wednesday, June 14, 2006 11:37 PM Subject: [PHP] can I do this: update table while selecting data from table? 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