altering columns

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
taldos
Forum Commoner
Posts: 39
Joined: Mon Aug 23, 2004 8:47 am
Location: Philadelphia

altering columns

Post by taldos »

Since I don't want to have my server take 5 hours to send out emails to all members in a database set, I am using cron to run scheduled php files.

As a result I have been forced to create a table as follows

---------alert_sent | owner_id
______________|____________
row1
row2
row3

using:

Code: Select all

"SELECT t1.owner_id, t2.email 
FROM table1 AS t1
LEFT JOIN table2 AS t2 ON t1.owner_id = t2.id
WHERE t1.alert_sent = 0";
what I would like to do is to reset the entire "alert_sent" column to "1" once I have sent the emails. I know I can loop through individual row, but I'm sure there must be a way to just reset the column to 0 for every row.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

UPDATE tableName SET fieldName = 'value'
no where clause required if you want to hit all records.
Post Reply