Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Delete Records Older Than 14 Days


Does anybody know how to make a script that automatically removes mySQL records older than 14 days?




View Complete Forum Thread with Replies

Related Forum Messages:
How To Delete All Database Entires Older Than 30 Days?
One of the fields in my database is called ad_date which is of date type and stored dates int he format YYYY-MM-DD. I would like to perform a DELETE SQL statement in my PHP script which deletes all records with an ad_date value older than 30 days.

I knoy this is also an SQL question, but it is the 'older than 30 days' part which I'm stuck with and so figured it would be better in the PHP forum as I think I need to use PHP to calculate todays date - 30 days.

View Replies !
Dates - Mysql Database Older Than 7 Days
I would like to delete all the records in mysql database that is older than 7 days.
How do i go about selecting it in the database ( currentdate - 7).

View Replies !
Delete Files From A Dir Older Than A Week
The below should delete files from a dir older than a week. I set the $dtime to 0 to test the script but it deletes nothing. What is wrong? Code:

View Replies !
Delete Entries 1 Week Old Or Older.
I have a query that's supposed to remove bulletin entries that are a week old and over, but its not working, and the "date" column is filled with "time();"

<?php mysql_query("DELETE FROM `bulletins` WHERE `date` > (time() + (3600*24*7))");?>

View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes?

My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12

I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.

View Replies !
Query For Records Older Than A Date?
I need to write a query for a table that has records that are up to 5 years old. I need the query to return records that are older than 6 months only.

There is a date field in the table. Using date_sub and interval I know how to get records between today's date and an interval, but not records older than that interval.

select * from tables where date_checked BETWEEN DATE_SUB(CURRENT_DATE(),INTERVAL n DAY) AND CURRENT_DATE();

View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:

View Replies !
Delete Files That Are 4 Days Old
i have a code that deletes files that are certain days old, but i dont know exactly how old and i wanted to increase it to delete files that are 4 days old.

unlink $filename if $current - (stat $filename) [10] > 1 * 60 * 60 * 24;

View Replies !
Delete Field After X Days?
I have a table containing user created data, and once this data is 30 days old id like to delete it from my database.

Whent the data is uploaded initially i add date(Y-m-d); to my database, however i cant get my head around how to add 30 days to this and check it.

so, i was considering creating another field to hold a unix timestamp when the data is uploaded, then simply seeing if this field was less than the current timestamp minus 2592000 (30 days in seconds).

View Replies !
Displaying Records After 2 Days
I trying to display only records that are 2 days old so the owner of the site can preview new records before they are available to others, this is what I've got so far...
$sqlquery = "SELECT headline, news, date_format(date,'%M %D %Y') as time FROM $table WHERE date < NOW() ORDER BY date DESC";

is there a way to extend it by 1 or 2 days, i've tried the TO_DAY function but couldn't get it to work either.

View Replies !
Display Records 30 Days From Now
I am trying to display records that are 30 days from the current time.  Someone suggested the following:

select * from table WHERE date_column BETWEEN CURDATE() and DATE_SUB(CURDATE(),INTERVAL 30 DAY)

View Replies !
Displaying Records That Are Less Than 30 Days Old.
I have records that are dated using date('y,m,d') when they are created.

Would like to only display records that are less than 30 days old. So, IF record is older than 30 days - do not display. Here is my code:

$arr = $db->getArray("SELECT * FROM table WHERE id = '$id' ORDER BY date ASC");

View Replies !
Update All Records In A Database 364 Days
I have a calendar with events for this year in a SQL database that I would like to use for next year too (the events will remain the same). The days of the week are important; what is on Monday, November 6, 2006 should be on Monday, November 5, 2007.

I will copy the existing table to another table for the next year, so what I would want to do is update the dates to be 364 days from each date.

Does anyone know a command that I can update all records by 364 days?

The table is practice07
The field is PracticeDate (that holds the date that I want to update)

View Replies !
SQL - Selecting All Records From Past 30 Days...
How do I only display records solely from the past 30 days with an SQL query, using the 'date' field in my database? The column in the table is called 'date' and uses date type :

date date No 0000-00-00

I have tried :

DATE_SUB(CURDATE(),INTERVAL 30 DAY)

but to no avail.

View Replies !
Records Won't Delete
mysql_query("DELETE FROM guestbook WHERE id = '$recnum'"); It works fine on my local server but it doesn't delete records on the remote server. any ideas?

View Replies !
DELETE Records
I am going to write a php script to delete some records based on values supplies by the user. I was just wondering if the query is correct but there are no records to delete for example if this query was executed but there was no testId 7, would an error occur or would the query be performed but just not delete any records? PHP Code:

$testId = 7;
$q="$q="DELETE  FROM test WHERE testId = $testId";
mysql_query($q, $link_id)or die(mysql_error());

View Replies !
Wants To Delete Old Records
I want to delete records that are more than 7 days old($keeptime). I am new to this and can't figure out the correct code. The table is called 'x4tables' and the field 'tdate' is a timestamp. I have used: Code:

View Replies !
Delete Records Since A Week
I've been trying to delete records since a week and i'm not able to do it. Before with this script, i was doing so many things at a time and i was confused.But, now, i just displaying the records from a table N trying to delete them.Would somebody pls guide me.

I just wanna set the delete flag(i.e, i want to set the RBS_DELETE column to Y or something) when i check a check box to delete it. I've some 5 records displaying on my form and i want to check 3 of them and when i check them and hit submit, i want the RBS_DELETE column to have some value. PHP Code:

View Replies !
How Do You Delete Records From Mysql
Could someone please show me how to delete records from mysql. Maybe even an example in a loop that deletes records based on a criteria.

View Replies !
Delete Records From A Table
I have a table its called queue. It has a field called id. I want to delete all records in the table apart from the ones with id equals to 74 or 75 or 87. How do i do that?

View Replies !
Forms To Delete Records
I am trying to make a PHP script that displays all of the records from a database, then allows a user to edit or delete the records via a form. I need a checkbox beside the names and a text field with a number beside each name. Is there a way to make it delete all names with a check beside them and update all number that have been changed when the user clicks submit?

View Replies !
Delete Records From Table 1
I have a script that doesn't delete records from one database when it should, and now I have to do this myself because database is big and causes problems on the server. What I have is:

TABLE 1, field auction
TABLE 2, field id

so I would like to delete all records from TABLE 1 where the value of the field auction doesn't match the value of the field id in TABLE 2. Can someone help me on this, please? I need to get this database cleaned.

View Replies !
Delete Specific Records
On clients machine, currently to delete on trainee record it runs 10 queries to delete records from 10 tables. At the time of running all queries, server shows (104) Connection reset by peer. An error condition occurred while reading data from the network. I think it because of running 10 queries at a same time. Is there any possibility that through one line of query we can delete record from 10 tables. I've tried following query

DELETE FROM table1, table2, table3, table4, table5, table6, table7, table8, table9, table10 WHERE empID = 11;

But it gives ' error in query.

View Replies !
Delete All Records Starting In R
PHP Code:

$result2 = mysql_query ("DELETE FROM r_CompTables WHERE CompID = R??") or die("DELETE error: ".mysql_error());

I have this code but I want it to delete anything start in R. R will be followed with a number so it could be R5 or R91.

View Replies !
Want To Delete The First Letter In A Column With 275 Records
table : product
column : code

in this column i have 279 records with bv. S1092734 i want to delete the first letter in all those records.

View Replies !
Delete Fixed Number Of Records
i have a table with one field. this field saves times as records. i want to there are 40 recoreds always. in other mean when inserts 41'st record then 1'st record be delete
how to delete fixed number of records at a time of first of my records asc (like select).
in other mean i want to like: delete from table order by time asc limit 0,1

View Replies !
Delete Selected Records From Table.
Can anyone see why this connection doesn't work? It's suppose to delete selected records from my table.

<?php

if (isset($_POST['delete'])) // && isset($_POST['delcus']))
{

foreach ($_POST['delcus'] as $val)
{
echo "$val";
$conn= mysql_connect( "localhost", "user", "password" );
$sql = mysql_select_db( "snow" );
$del = mysql_query("DELETE * FROM request WHERE qid =" .$val);
//$rows = mysql_num_rows($del);
$rs = mysql_query($conn, $sql, $del);
if($rs)
.........................

View Replies !
Multiple Delete From A List Of Records
If I have a list of records from a database on the screen, each with a check box beside them, how would I delete all the records that have been ticked? I assume I would use a variable similar to checked[], but not sure what syntax I would use to remove them from the database? Would I loop round each record comparing the checked[] value and it it's set, delete the record?

View Replies !
Do A DELETE Statement To Remove Any Records That Don`t Match.
I`m just trying to figure out the best method to delete my records and wondered if it was possible to do a DELETE statement to remove any records that don`t match. Here is my code so far:

$Query="select blah its huge:-)";
$RESULT=mysql_query($Query);
$my_rows=mysql_num_rows($RESULT);

for ($a=0; $a<$my_rows; $a++){
mysql_data_seek($RESULT, $a);
$Array = mysql_fetch_array($RESULT);
printf("%s<BR>", $Array['Email']);}

My Query returns Matched Records, what I would like to achieve is deletion of the records that didn`t match, would it be possible to do that under the printf statement. So delete all the records in the table that don`t match up to $Array['Email']??

View Replies !
Delete Option From My View Records Page
I have a list of things I need to do with my database - but this is my next hurdle - the delete query within my view records page. I want to be able to click on a button or link to delete a record in a table. I was envisaging that each record would have a delete button or link next to it and clicking that would remove it. Here is the script I have created to view "Devices": PHP Code:

View Replies !
Delete Records And Files In 1 Statement At Same Time?
How can i delete records and files in 1 statement at same time?

View Replies !
Delete Multiple Records In The Same Database Querie?
I have some code that deletes records from the database, in a loop. However its prety inificient as it makes a seperate database call in every loop whcih is slow. PHP Code:

for ($i=0; $i<count($idarray); $i++)
          db_query("delete from clicks where id='$idarray[$i]'");

Is their a more efficient way of doing that? It is posible to delete multiple records in the same database querie?

View Replies !
Database Delete Repeat Records And Add Up Totals
I have a database full of order records for our website. My goal is to delete people from the same 'address' field and add up the 'total' into one record. Can i get some example code on how this would be done?

View Replies !
Automatic Delete From MySQL Database Table Expired Records?
I have a question . . .

how can i delete from MySQL database table automatic expired records ?
?

One think is to make a service that deleting the expired records . . .

Any other method ?



View Replies !
Auto Delete The Old Records But What If Server Clock Was Set Up Wrong In Maintenance?
I want auto delete any events that the event date is at least 1 day older than current date. No problem for the php programming. get the current data (server clock), check the events date and delete the old records. My problem is that for some very rare cases.

Say if for extrem cases I have 1000 new events saved in database. But somehow, I or the the hosting company do the server maintenance, and reset the time clock of the server, in case in the maintenace, the server time clock was set up wrong say 2005, was set up as 2006. Code:

View Replies !
Older PHP Manuals?
I'm trying to use the DOM XML functions, but because they're in development and my hosting provider only has 4.0.4 installed, I don't have the proper documentation. Does anyone know where I can locate an older version of the php manual?

View Replies !
Clearing Up Older Files
Wonder if you bunch can help me (again!)... i'm looking for a way to read the filenames and dates in a directory, and delete everything which is more than 24 hours old.

It's gonna be part of a garbage cleaning routine for old temporary downloaded files.

View Replies !
Php Compatable With Older Browsers
are all the functions of php compatable with older browsers? if not what functions don't work?

View Replies !
Show Older Entries
I have a MySql table with the field "sentdate". How could I set up a query that selects only entries that have a sentdate that is for example 30 days old?

View Replies !
How Do I Get First Timestamp Older Than 24hours?
I would like to query results of post timestamps (say 10 results sorted in DESC order) and have it read the timestamp of the most recent... Then go through the remaining 9 results and return the next timestamp that is at least 24 hours (or 86,400 seconds) old or older...

Is an if/elseif/else the only way to do it or is there something more elegant/efficient?

Also, is there a way to stop it if there aren't 10 results available?

View Replies !
Download PDF In IE6 Older Versions
I have a script to download text and pdf documents from a site but am encountering problems in older versions of IE. I have adapted the script that we have in house to the following. If anyone can spot out any flaws or offer critique please comment. The main problem the client has is that a white screen appears when the button is clicked.

<input type="button" value="Download" onclick="window.location='/about_us/jobs/?action=downloadFile&amp;documentID={$key}'" />
private function downloadFile()
{
$documentID = intval(stripslashes(strip_tags($_GET['documentID'])));
if ($this->db->fetch_result($this->db->query("SELECT COUNT(*) FROM job_documents WHERE documentID = $documentID"))!=1) {
header('Location: /about_us/jobs/');
exit;
}
$jobID = $this->db->fetch_result($this->db->query("SELECT jobID FROM job_documents WHERE documentID = $documentID"));
$this->forceDownload($documentID,$jobID);
...

View Replies !
Deleting Older Entries.. (mysql)
I've a comment form.. I've allowed only 10 comments to be viewd, so when I submit new comments, I want to know how to delete older ID comments except the latest 10 comments. Means if there are 13 comments.. 13...3 shd be there and very 1st and 2nd(older) comments must be deleted.

View Replies !
Detect MSIE Older Than Using Less Than Operator?
Here is my attempt at detecting an MSIE browser (in this instance, older then 5.5). The first part works fine but I'm still in the wrong valley as far as the browser's version number goes. Code:

View Replies !
Deleteing MySQL Rows Older Than 1 Hour
Hi, as the title says, I have a mysql table which logs data, I have a timestamp field which collects what time the record was added, I really need to know howto setup a WHERE clause which will tell mysql to delete rows that are older than one hour, can anyone help?

View Replies !
Older GD Lib And Jpeg Photo Thumbnail Generation
I'm using a server which only has GD version 1.6.2, with jpeg support
enabled. I'm trying to use it to make thumbnails of jpeg photos as they are
uploaded from a webform, but moving from my development server (which has GD
2.x) to the real server I noticed the lower GD lib version, and that it
doesn't support imagecreatetruecolor. Without this, using imagecreate, the
converted image always come out almost always a single colour, or with very
little variation in the colour. Using some images I found in XP as a test,
one has green plants with a few bright red flowers - if i just use
imagecreate, the bright red flowers are green too. I'm using
imagecopyresampled to do the copy. Is there another way to do this without
getting newer libraries installed on the server?

View Replies !
MYSQL PHP Code Works With Older Version.
I am having issue with they way that my PHP MYSQL code works with the MYSQL version 5.0.45 Here is the Code that inserts the data into the database. The thing is the tables that have a int in MYSQl error when there is no value present. Code:

View Replies !
MySQL Dont Show Older Than Today
I'm making a database for upcoming shows. so, what I wonder now, is there a way to show only upcoming shows, and just exclude the shows older than todays date? what I've got atm is: Code:

View Replies !
Migrating Existing Site From Older Version Of PHP & MySQL
There's an existing website (on a single box running Linux, Apache, PHP 4.1.2, MySQL 3.23.58) that I need to migrate over to another setup (2 boxes, the web/app server running MS 2003 Server, IIS6, PHP 5.2.4 and a DB box running on SuSE, MySQL 5.0.26). I've gotten the connection between the two new boxes to work, but a lot of the code from the original website doesn't seem to work.

Is there anything obvious I should know about migrating code from the older setup to the newer one, which is running different versions of PHP and MySQL. I've attached 2 php files (both renamed to txt). When I bring up the dir_master.php file, the only thing that comes up is the Name, Affiliation, and Department headers from the contents.php file.... nothing gets displayed from the MySQL database. Like I said, I have been able to pull stuff out of the DB using code I wrote myself to test it, so I'm sure the PHP to MySQL connection is working.

I think the issue might be with the PHP code and how the HTML is embedded in it, but like I said, this isn't my field of expertise. I'm hoping there's a quick syntax fix that I can use without having to completly rewrite everything.... especially since there's a number of PHP files that will need to get changed.

View Replies !
Working With Dates - Entries Older Than 2 Weeks To Be Deleted From The Db
I'm having the a date stored in my db in yyyy/dd/mm format. I want all the entries older than 2 weeks to be deleted from the db. How can i do the calculations to find if the entry was added more than 2 weeks ago?

View Replies !
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong?

<?
include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$id="delete from todo where id='$id'";
mysql_query($id);

mysql_close();
?>

View Replies !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ?

$query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt  WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error());
im just getting "Unknown table 'notes' in MULTI DELETE" ?

View Replies !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page.

I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields.

If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved