CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Perl/MySQL and showing messages based on time

 



yim111
Novice

Dec 7, 2002, 4:04 PM

Post #1 of 2 (294 views)
Perl/MySQL and showing messages based on time Can't Post

Hello,

I am trying to write a script that will insert messages into a MySQL database, with a timestamp, and display only messages that have not expired.

The input from the html form is in the form of:
Name:_____
Email:____
Message:____
Expires:____

Expires is an hourly value, either 1, 2, 3, 4, or 24 hours. Basically a user fills in the form, selects one of the 5 hourly values and submits. The script would insert the values in the database, and timestamp the entry. There would be another link/html page to display all entries in the datebase - that haven't expired. I'm not sure if I will need a seperate script (and cron job?) to remove expired entries.

Any assistance on this project is really appreciated!

-jim


Paul
Enthusiast

Dec 8, 2002, 10:21 AM

Post #2 of 2 (285 views)
Re: [yim111] Perl/MySQL and showing messages based on time [In reply to] Can't Post

You don't need a seperate script to display the non-expired entries but you probably will do to actually remove expired entries.

eg...


Code
my $query = "DELETE FROM table WHERE (((expires_col * 120) + timestamp_col > UNIX_TIMESTAMP())"; 
$dbh->do($query) or die $DBI->errstr;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives