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 Complete Forum Thread with Replies
Related Forum Messages:
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 !
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 !
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 !
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 !
How To Remove Entries In A DB That Are A Week Old?
I ahve a social network and I have a bulletin system, taht allows users to post bulletins that all their friedns can read... well anway, i dont want the bulletin to just sit there and take up DB space, how would i go about removing "bulletins" that are over a week old?
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 Entries From ODBC
i have an Access Database that i can read and write to no problems however, when i try to delete an entry it all seems to run with no error but the record never deletes!!!!! The '$_POST[id]' is from a previous page. Code:
View Replies !
Display For The Week Of (fridays Date Of The Week).
I have a report that people can access online and it generates data for a given week until friday. In the title and on the report, I want to display For The Week Of (fridays date of the week). Instead of writing a huge if - then statement array - is it possible for to simply have an expression that figures out what day it is and then tells me Fridays date - has anyone ever done anything like 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 !
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&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 !
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 !
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 !
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 !
Day Of Week ?
Is there a way I can obtain the day of week - If I have the day, month, year ? (not via the time function - But from a database....) Im looking through the calendar and date functions -But can't locate anything suitable...
View Replies !
Day Of The Week?
is there a way to get the day of the week in php? i want to get the correct values monday, tuesday, wdenesday, etc. for the actual day it is.
View Replies !
Getting Day Of Week Out Of Datestamp
I currently have a datestamp in the format yyyymmdd. I want to pull the day of the week (Monday, Tuesday, etc...) out of that datestamp at any given time. Currently my code looks like this: $datearray = getdate($firstdatestamp); echo $datearray["weekday"]; When $firstdatestamp = 20000501 (or the first of May, 2000) the weekday returned is Thursday when really it should be Monday! I tried: echo date("l", time()); and it gives me the right weekday but only for the current date. I need to pass this my datestamp and am not too sure how.
View Replies !
Getting Day Of The Week From A Date
I tried searching the old postings, but to no avail. I am trying to figure out a way to get the day of the week from a date. Basically, I have a date in the format of 05/02/2003 (but I can change that format easily) and I need to have my program figure out which day of the week that was. All of the dates that I have will have already passed.
View Replies !
Date Of The Week
Can anyone help me? I am trying to work out the timestamp for the first DATE (not day) of the current week and last date of the current week. Any ideas?
View Replies !
Date To Week # Fct
I'm searching a PHP function that would translate a date in the following format yyyymmdd to the week number in the year... ex : 20040128 => 5 i.e. jan 28th 2004 gives week nb 5 in 2004.
View Replies !
Getting SQL Rows For A Week
I have a database that uses two date fields for tracking information. The first field is for the addition of the record and the second is for the expiration. I have a small section that I want to list records that will expire in the current week (or for that matter in the next 7 or 14 days). What is the syntax that I would use to call mySQL with to get that info.
View Replies !
Week Of The Month
I need to determine the week of the month (1-5) so I can rotate menus for a cafeteria. Is the following, which I know prints the week rather than storing it, the simplest or easiest way to determine the week? PHP Code:
View Replies !
File Of The Week?
I wish to add an automated "file of the week" feature to a site for users to download. I was having a little trouble explaining this.... So I ended up making these few points on the functions of the script I'm aiming for: - The script finds the folder with the files for the current week. (If the download was a wallpaper, there would be files for different resolutions, and therefore more than one file.) - Links are then made to the files. - Every week, the links are updated for the new files for the current week. I was thinking along the lines of putting the weekly files into folders named after timestamps and going from there... Is that the way to go? And how would it be done? I can't quite figure this out.
View Replies !
Printing Every Week
im trying to print a list of every Friday since a date defined. Let me try and explain. I want to define a date such as 2007-07-06 (which is a Friday) and then let php print each Friday since that date until today. For example, if the date defined was 2007-07-06 then it would print 2007-07-06 2007-07-13 2007-07-20 2007-07-27 2007-08-03 2007-09-14 But I want to also be able to format the date it outputs, so it might look like Friday 06 July 2007 Friday 13 July 2007 Friday 20 July 2007 and so on.
View Replies !
Week Before Date
Im looking to get the date 7 days ago. I know how to do 7 days ahead: $timeStamp = strtotime($oLastBatchDate->Last); $timeStamp += 24 * 60 * 60 * 7; $NextBatchDate = date("Y-m-d H:i:s", $timeStamp); However, does anyone know how to do 7 days back?
View Replies !
Date And Week
I am looking for a way to determine the week of the year if i have a date.i know that date("W"); give me the week Number but not sure how to determine the week based on the date.
View Replies !
Day Of The Week Program
I am trying to write a program that will give me the day of the week without using the date function. I input the date and it's supposed to spit out the name of the day of the week. Here is what I have so far. I don't know quite what to do next. Code:
View Replies !
Get Dates Before From Last Week
<?php //today date is: 2006-04-10 08:18:24 //last week is: 2006-04-03 06:23:10 $lastWeek=date('Y-m-d H:i:s', strtotime('-1 week')); //How do I get any date before last week(2006-04-03 06:23:10) //This show all date start from last week (2006-04-03 06:23:10) up to today (2006-04-10 08:18:24) $result = mysql_query("SELECT * FROM $table WHERE dateCreate >= '$lastWeek' //I want the opposite of this, from before last week, not from last week up to today. ?> How can fixed the above code to get all dates in the database from before last week? Any idea?
View Replies !
Days Of Week
I'm attempting to display information for today, the next day and the day after (so only three days worth). The first day is hardcoded to say now. I want the next day and the day after to be the abbreviated day (ie. Tue, Wed and so on). The problem I have with the following code is that now and the next day are the same. Thus, I have now (which is Tue), the next day (which is ALSO Tues - wrong!) and the day after is Wed. Here's the include: $return['mydata'] = array(); for($i = 0; $i < 2; $i++) { $attr = explode('"', $this->tag('blm:mydata',$i)); if(count($attr) > 1) { $day = array(); $day['when'] = $attr[1]; $day['image'] = IMAGES.$this->translate($attr[11]).'.gif' array_push($return['mydata'], $day); } } return $return; And here's the front-end page: echo " ".$stuff['mydata'][0]['when']."<br/>
View Replies !
Week To Date.
how i can make a week number to a date string. Ex. week 1 ---> 1 Jan. till 7 jan. Date format is not important.
View Replies !
Select Last Week
Is there a 'proper' way to select items with a date belonging to the previous week? I have this - SELECT n from table where YEARweek(a datestamp) = YEARweek(CURRENT_DATE - INTERVAL 7 DAY) && year(datestamp)=year(current_date) ... I think the flaw with that will come during the first week of January? Is there a better way?
View Replies !
Days Of Week In App
recommend for a best approach to populating a Days-of-the-Week table in an event-scheduler app? in my particular case, each day of the week relates to a daily drink-special for a bar. i'm trying to figure out my order of dependencies. here's a snapshot of my tables if i am going to add an event,i have to have it on a day of the week. that day of the week needs to have it's specials populated in order for it to exist in the Table. so, how should i go about "forcing" the Event Scheduler App User to first populate the Days-of-Week table so that when she adds data for an event, the dayys of the week will be available to input into the Event table?
View Replies !
|