hinch
10-25-2011, 02:02 PM
OK I think I must be going insane.
On every page load (in the footer of my site) I run a series of update queries to automatically adjust status' of items based off start and end dates.
This appeared to be working when I first wrote it months ago and since nobody had complained to me I assumed it was still working. However I've recently (today) implemented an email alert system to the update the response to which was 300+ emails arriving - one for every page load - almost instantly which shouldn't happen as the update should adjust the status's and then the items should stop hitting the email flag as they'll be in the correct status for the date.
I've tracked the error down to the update queries but can't for the life of me work out why they're not working properly.
UPDATE `tblsites` SET ProjStatus =3 WHERE `SiteEndDate` < NOW( ) AND ProjStatus !=4;# MySQL returned an empty result set (i.e. zero rows)
SELECT GGInternalID
FROM `tblsites`
WHERE `SiteEndDate` < NOW( )
AND ProjStatus !=4; # Showing rows 0 - 29 (59 total, Query took 0.0416 sec)
The select should return zero as the update was done prior to it but as you can see the update returns zero affected rows.
Where am I going wrong.
On every page load (in the footer of my site) I run a series of update queries to automatically adjust status' of items based off start and end dates.
This appeared to be working when I first wrote it months ago and since nobody had complained to me I assumed it was still working. However I've recently (today) implemented an email alert system to the update the response to which was 300+ emails arriving - one for every page load - almost instantly which shouldn't happen as the update should adjust the status's and then the items should stop hitting the email flag as they'll be in the correct status for the date.
I've tracked the error down to the update queries but can't for the life of me work out why they're not working properly.
UPDATE `tblsites` SET ProjStatus =3 WHERE `SiteEndDate` < NOW( ) AND ProjStatus !=4;# MySQL returned an empty result set (i.e. zero rows)
SELECT GGInternalID
FROM `tblsites`
WHERE `SiteEndDate` < NOW( )
AND ProjStatus !=4; # Showing rows 0 - 29 (59 total, Query took 0.0416 sec)
The select should return zero as the update was done prior to it but as you can see the update returns zero affected rows.
Where am I going wrong.