Jump to content

Recommended Posts

That does not delete anything, even if I set it for 1 second

 

Here is what the database looks like

 

CREATE TABLE `visits` (
  `id` int(11) NOT NULL auto_increment,
  `ip` varchar(20) NOT NULL default '',
  `country` varchar(50) NOT NULL default '',
  `region` varchar(50) NOT NULL default '',
  `city` varchar(50) NOT NULL default '',
  `time` int(11) NOT NULL default '0',
  `vcode` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
);

 

This is what the time field looks like

(unix time)-->1248106995

 

this what my php looks like I tested with

<?php

require "./connect.php";
$before = time() - 5;
$sql = "DELETE FROM `visits` WHERE `time`< '$before'";

?>

 

I would like to delete entry's older then x amount of seconds to test first

 

Thanks for helping

Sonny

oh...well...you need to add a mysql_query() to it...i just assumed you knew to do that:

<?php

require "./connect.php";
$before = time() - 5;
$sql = "DELETE FROM `visits` WHERE `time` < '$before'";
mysql_query($sql) or die(mysql_error());

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.