Jump to content

Archived

This topic is now archived and is closed to further replies.

master82

Mass Delete #solved

Recommended Posts

I'm trying to write a simple code that will delete the whole row of expired session data I store on my database.

[code]
<?php
include("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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
You were right, the arrow was the wrong wat around - also I needed to place ' ' around my $now

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.