 |
Results from the most recent live auction are here.
19 members in the live chat room. Join Chat!
| |
10-12-2003, 02:47 PM
|
· #1 | | NamePros Member Join Date: Jul 2003
Posts: 120
NP$: 185.00 ( Donate)
| mySQL timestamp(14) I am trying to find the difference between the current date and and the date each record was created in my database. I have used a field called date in my database of type timestamp(14) which automatically inserts the date and time the recorde was created.
Now how do I get the diff?? |
| |
10-13-2003, 01:59 AM
|
· #2 | | Senior Member Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 ( Donate)
| |
| |
10-13-2003, 02:10 AM
|
· #3 | | NamePros Member Join Date: Jul 2003
Posts: 120
NP$: 185.00 ( Donate)
| I was trying to figure this out all last night and I finally cracked it. I was trying to find the difference using php, but it was proving difficult because, well lets just say it was to dam awkward. So I found that it was easier done using SQL, like the way you did it dead. The following peace of SQL checks the database and any records that are over five days old are deleted. Code:
mysql_query("DELETE FROM pass WHERE TO_DAYS(NOW()) - TO_DAYS(date) > 5;")
I am going to run this as a cron job every night so that old entries are deleted out of my database. |
| |
10-13-2003, 02:59 AM
|
· #4 | | Senior Member Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 ( Donate)
| Cool, atleast you figured out something that works for what you wanted.
I wonder what you're doing though, deleting users after five days or just their password or? Just curious.  |
| |
10-13-2003, 03:54 AM
|
· #5 | | NamePros Member Join Date: Jul 2003
Posts: 120
NP$: 185.00 ( Donate)
| I am deleting users after five days, as they have up to five days to access the site and download the product that they have paid for. |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |