kirkh34 Posted May 13, 2010 Share Posted May 13, 2010 i have two tables of user messages that when put in the trash, receive a date 2 weeks ahead of the current time in the trash_expire column, i am trying to make an if statement, if now is greater than the expiration, delete the row....i cannot get this right i have tried for days $sql = mysql_query("SELECT * FROM message_sent WHERE message_trash = 1 UNION SELECT * FROM message_rec WHERE message_trash = 1") or die (mysql_error()); while ($row = mysql_fetch_array($sql)) { $trash_expire = $row['trash_expire']; $trash_expire = strtotime($trash_expire); $now = strtotime("now"); if ($trash_expire < $now) { $sql = mysql_query("DELETE FROM message_rec WHERE trash_expire < '$now'") or die (mysql_error()); $sql = mysql_query("DELETE FROM message_sent WHERE trash_expire < '$now'") or die (mysql_error()); } } //close while Link to comment https://forums.phpfreaks.com/topic/201595-delete-after-row-expires/ Share on other sites More sharing options...
katierosy Posted May 14, 2010 Share Posted May 14, 2010 If only "place" where it shows up is the issue, inside the <tr> tag , you may replace <td> with <th> tags and see. You may find it to work. Link to comment https://forums.phpfreaks.com/topic/201595-delete-after-row-expires/#findComment-1058222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.