master82 Posted June 12, 2006 Share Posted June 12, 2006 I'm trying to write a simple code that will delete the whole row of expired session data I store on my database.[code]<?phpinclude("connect.php");$now = time();$sql = "DELETE from active WHERE expire >= $now";$result = mysql_query($sql,$conn) or die(mysql_error("Unable to delete expired"));?>[/code]I thought that was it until I came to test it - can anyone tweek the code or point me in the right direction? Quote Link to comment https://forums.phpfreaks.com/topic/11820-mass-delete-solved/ Share on other sites More sharing options...
.josh Posted June 12, 2006 Share Posted June 12, 2006 think it should be expire <= $now Quote Link to comment https://forums.phpfreaks.com/topic/11820-mass-delete-solved/#findComment-44786 Share on other sites More sharing options...
master82 Posted June 13, 2006 Author Share Posted June 13, 2006 Tried both < and > and changed the date on the database to days/months ago. Everytime I run it I get the message "unable to delete expired" - so I'm guessing I'm doing something else wrong.Anyone know what? Quote Link to comment https://forums.phpfreaks.com/topic/11820-mass-delete-solved/#findComment-44792 Share on other sites More sharing options...
master82 Posted June 13, 2006 Author Share Posted June 13, 2006 You were right, the arrow was the wrong wat around - also I needed to place ' ' around my $now Quote Link to comment https://forums.phpfreaks.com/topic/11820-mass-delete-solved/#findComment-44799 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.