isedeasy Posted June 1, 2010 Share Posted June 1, 2010 I would like to set up a cron to automatically remove items that have a low score after the first day. The problem is that I want to run a function that sends off a pm to the user for each item that is removed. At the moment I just have mysql_query("UPDATE deals SET status = 2 WHERE score < 0 AND added > $day AND status = 1"); Is there away to get an array of rows affected? Link to comment https://forums.phpfreaks.com/topic/203508-running-a-function-for-each-update-row-in-a-query/ Share on other sites More sharing options...
aeroswat Posted June 1, 2010 Share Posted June 1, 2010 Quote I would like to set up a cron to automatically remove items that have a low score after the first day. The problem is that I want to run a function that sends off a pm to the user for each item that is removed. At the moment I just have mysql_query("UPDATE deals SET status = 2 WHERE score < 0 AND added > $day AND status = 1"); Is there away to get an array of rows affected? You could run two queries if you wanted. The first of course would be a select that would check for the records with the same WHERE conditions and then print them to the user in whatever way you are doing it. The second would be the update. The only function that is most like what you need displays only the number of rows affected http://php.net/manual/en/function.mysql-affected-rows.php Link to comment https://forums.phpfreaks.com/topic/203508-running-a-function-for-each-update-row-in-a-query/#findComment-1066087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.