Forum Moderators: open

Message Too Old, No Replies

updating multiple Id' s in a row?

any help would be helpful

         

sarah83

6:03 am on Apr 17, 2006 (gmt 0)

10+ Year Member



Hi

I am in trouble, My script send automatic email everyday to a user. What I want to do is to set the value of a row to 0 so that it stop sending automatic email , below is the working code. But I want to do it to all users for example to multiple id's?

UPDATE `email` SET `send` = 'o' WHERE `id` =20 LIMIT 1 ;

help plz

ps. I use phpmyadmin

jckptr70

3:17 pm on Apr 17, 2006 (gmt 0)

10+ Year Member




UPDATE email
SET send = 0
WHERE id IN (20, 21, 23)

OR

UPDATE email
SET send = 0
WHERE id IN (SELECT id FROM <table>)

sarah83

5:20 pm on Apr 17, 2006 (gmt 0)

10+ Year Member



hi kind man! thanks for answering, I tried that one to run as sql query in phpmyadmin.

UPDATE 'email'
SET sent = '0'
WHERE id IN (SELECT id FROM 'email') ;

but i get that error:
You have to choose at least one column to display

:(

let me explain more:

Table email has many fields but I want To update The Send field which has a value of 2 and when it is 2 it keep sending email.
I have 2000members in database so I need a query to make all Field sent on tabel email 0.

jckptr70

8:53 pm on Apr 17, 2006 (gmt 0)

10+ Year Member



I never worked with phpmyadmin, so I can't help you on specific problems for that, maybe it only helps you set up select-statements and no update-statements.
Try to find a way to interact with the database more directly.

If you want to update all the fields than this should be enough:

UPDATE email SET sent = '0'

sarah83

6:00 am on Apr 18, 2006 (gmt 0)

10+ Year Member



hey thanks sweety ,
that last command worked.

thanks a lot