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 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 Complete Forum Thread with Replies

Related Forum Messages:
Delete Records Older Than 14 Days
Does anybody know how to make a script that automatically removes mySQL records older than 14 days?

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 !
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 !
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 !
Delete Record
i have this code for my site that will connect to my database and grab all my members there id email and ip the problem is that it dont have a button where you can select a member and delete that member can anyone help me with this?i want to add a button and a check box so if i check off a member and click a delete button it will delete that member here is the code:

View Replies !
Delete Record!
I am using PHP5 , MySQL5, Apache 2 My Database was created with phpmyAdmin.Then I inserted with script and phpmyAdmin data into the Database. Now I am Unable to empty or delete or remove any fields out of the Database. Neither a script ot phpmyAdmin can delete.What has blocked the database? I have restarted my pc, Still I am unable to remove anything.

View Replies !
Delete Record And Files
I have a code that uploads images along with some info into a directory and database, this all works fine. I can delete the record but the images relevent to that record continue to exsist in my images directory. How would i set up a php code to delete a file in ../images when the record of its name is stored in a column in my database. Here is my delete record code:

View Replies !
Mysql Delete Record
when I run this code below it doesn't delete the record or display any error message

$id = $_GET['id'];
include("../dbconnect.php");
mysql_query("DELETE FROM promotions WHERE id='$id'") or die(mysql_error());

Such a simple thing to do but I don't no why it doesn't work 

View Replies !
Unable To Delete A Record Using Php
I am having a form which displays a couple of values from database and a delete button which is used to delete that particular record. Below is the code that I am using, but I am unable to delete the record. Please help me to get the record deleted. Code:

View Replies !
Confirmation When Delete A Record
I want to add a confirmation before I delete a record. For example if the user wants to delete they press "Yes" otherwise "NO" and go back.

<?php

//delete user
$sSQL = "DELETE FROM user WHERE (`userid` = ".$_GET['record_id'].")";

$result = mysql_query($sSQL) or die(mysql_error());

echo "<h1> User deleted succesfully</h1><br>";

?>

View Replies !
Delete Record - You Have An Error In Your SQL Syntax;
Im some having  trouble with deleting a record, surely it isnt that hard, dont know what im doing wrong. this is the error i am gettin:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '` WHERE id=1' at line 1Here is my delete code:

View Replies !
Click Link To Delete Record
I am trying to add a function to one of my scripts.  I would like to be able to click a link and have it delete a particular row from by DB.  Links are generated by a PHP script and are based on entries on a DB.  In this DB I have a column called 'users'.  The table is generated by the following snippet: Code:

View Replies !
Using Checkboxes To Delete Record From Database
i would like to use check boxes to delete records from the database. my problem is, the records belong to different tables. how do i indicate in my code "DELETE from blah blah... " from which table to delete from..

View Replies !
Dreamweaver Generated Code To Delete Record
I use the dreamweaver generated code to delete a record, how would i add some code to it to delete the files (images) stored in my../images folder, that are linked to the record being deleted, there field names are photo1, photo2, ect..... and there image names are stored in the database Code:

View Replies !
Auto Delete Record/Send Email After X Hours
What I have is a MySQL database which stores records that each have a date stamp on them (2 of them - one for record created date and one for record last updated date), what I want to do is try and have it so that records that haven't been updated in say 72 hours are automatically removed from the database, or the record is updated to set a flag as being out of date, or an email is sent to alert a user of the out of date record etc.

I can easily write the script with the SQL query to check the records by the datestamp and perform the actions needed if the records are out of date, however that requires someone to physically visit that page to run the script and clean up the out dated records. What I want to try and do is have this happen automatically on its own without someone needing to actually visit the page to run the script.

A good example is on eBay how emails are sent to you to let you know when your auctions are about to expire, i wouldnt imagine that eBay would rely on people visiting their website to make those queries run on the database so there must be a way of doing some automated script executio or having a scheduled task run on the server to have a PHP script run each day at midnight or something? Anyone know how to do this?

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 !
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 !
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 !
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 !
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 !
Script Repeat Updates The Record And Also Inserts Another Record With The Same Information.
I have a form which contains some fields that are populated with data from a table. This same form also has fields that are empty because the data has not been collected yet. The main table is called client with a primary key of client_id. What I need to do with this form is select the client and update the record into a new table with the missing information. If the client doesn't not exist in this second table, I need to insert the row otherwise if the client does exist in this table because of a previous update, update the record.

When I run my script, the insert works. When I try to run the script again and try to update the record, the script not only updates the record but also inserts another record with the same information. How can I write my script so it checks whether a client exists in a table and if it does, update the record and if the client does not exist in the table, add the client?

View Replies !
How To Securely Store A Record Index When Editing A Mysql Record
is there a secure way
to do this? the non-secure ways are, as i understand it, to populate
a listbox with indices as names, or maybe use a hidden control. is the
only secure way with sessions? i was also thinking about perhaps
creating a meta table that says who is editing which record right
now. any advice?

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 !
Compare Record With Session Variable And Update Record If Different
I'm trying to figure out how to create a session variable from a recordset field value in a mySQL database and compare this with subsequent values from the same field each time the page reloads. When the value of the field changes (as a result of a user update) I want to trigger an event (redirecting to another page). It's probably a very basic PHP function but I am a newbie with this language.


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 !
How Many Minutes
im trying to work out how many minutes have past and how many remain since the last datetime stamp...

does anyone know of any pre-existing functions for this before I reivent the wheel?

View Replies !
When Posting The Record Only The Last Record Is Getting Posted?
I'm able to collect data and place all the records under editing mode and able to edit the records. But when posting the record only the last record is getting posted. Code:

View Replies !
Run A Php Script Every 5-10 Minutes?
I have done with a script which will parse a website's xml format file and save(create own file name) that data into my server....

So, now i want to do a script that will run every 10 to 20 minutes that will run/execute my parser program becuase that website which provide me that xml data will update constantly. I have ask one off my friend and he tell me that i can run that php script with CORN and Telnet,and i have try it but cannot.

View Replies !
Time + 10 Minutes
$ganja=date("D dS M h:i A");

Assuming the above produced the following .

Tue 02nd Jan 11:55 PM

How do i add 10 minutes to it to produce this ? .

Wed 03rd Jan 00:05 AM

View Replies !
Run A Script Every X Minutes
Computer 1 sends every 10 minutes a file to Computer 2. This Computer 2 is actually
a web hosting service and i don't have a full control.

I want to run a script on this Comp2, that will check every 30 minutes, if the file
exist and its timestamp is no older than 30 minutes. If it's older, then sends me a
notification email (in case if Computer 1 freezes). All ok, but how can i run the script every X minutes?

View Replies !
Difference In Minutes
i have 2 time stamps i want to calculate the Difference in minutes.

View Replies !
Determine Minutes Ago
How could I take the time(); function and put it against an old value of time(); from a database and display "XX minutes ago".

View Replies !
Strtotime Missing A Zero In Minutes
I am working with strtotime. The following problem occurs when using this function:

View Replies !
How To Tell The Minutes Differance Between Two Dates()
Im using the date() function in this format:

date("d.m.y.H.i.s");

And im trying to work out a simple way to establish the differance in minutes between two sets of dates (as when 60 minutes hasnt passed since last use then they have to wait)

View Replies !
Convert Time To Every 5 Minutes
it's really a mathematical problem! when I get the minutes of today: PHP Code:

View Replies !
Converting Date To Minutes
I have $x="200504161035"
that is 10:35 on 16 April 2005.

My questuion: what is the *shortest* piece of code to convert that variable
to minutes? I have a feeling there is a PHP function that should be able to
do it but I cannot find it. The long way takes 5 lines of code.

View Replies !
How Can I Finalize A Session After Three Minutes?
How Can I finalize a session after three minutes?? How I use the
session_cache_expire. I've tried to use but i did't have too much
success...

View Replies !
Seconds To Minutes Conversion
I have a form where a user enters a value that will always be a number which represents minutes. I have the column that receives these values in the mysql table set to time format.

the problem that I'm having is when I send the value form the form to the mysql table the number is treated as seconds. how do I change it so that the value is treated as minutes and not seconds.

View Replies !
Do A Countdown In Minutes To The Next Whole Hour?
How would I do a countdown in minutes to the next whole hour?

View Replies !
Cookies Are 2 Minutes Off In IE (with Setcookie)
I'm testing pages using cookies set with setcookie.  I suddenly started experiencing failures in IE. But Firefox was still fine. I noticed that it had to do with the cookie expiry time  (I have v. 7).  I had lowered the expiry threshold so I wouldn't have to keep clearing my browser cookies to test.

Is there some kind of minimum expiry time for IE??  Like 2 minutes...? Does IE shave two minutes off the top? Here's what I found:

time() + 3600 gives me 58 minutes in IE and 1 hour in Firefox
time() + 60 gives nothing I have time to notice in IE and a minute in firefox
time() + 120 gives me a couple seconds in IE and 2 min in firefox

Is this an IE "feature" or is it me that's doing something wrong?  I am new to this after all... example of how i set the cookies:

$hour = time() + 120;
setcookie(wpsite, $_POST['username'], $hour);

does work for the most part, just that little issue so far. I don't care whether it's fixable or not, it's just that I though I was going crazy at first when I was trying to troubleshoot the problem; could not figure out what was going on initially.

View Replies !
Set A Session To Expire In 20 Minutes
Let's say you set a session to expire in 20 minutes. Does reading and/or writing a session value bump that time up each time, or does it expire 20 minutes from when it was first created? I am pretty sure it is the former, but I want to check to make sure.

View Replies !

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