Hi! What's the right syntax using a variable with Perl & MySQL query? I got an example for PHP: #$exp_time = time()-86400; #$query = "DELETE FROM cl_temp_users WHERE sign_up_date < $exp_time;" ; But with Perl it does not work, like I have tried below. How to put my $sth line with prepare right so that I can use $exp_time2 in query? I tried:my $sth = $dbh->prepare('delete from cl_items WHERE "date_time < $exp_time2" ');, But with ""s nothing happens to my table. So I want records older than 1day removed from table. My CODE:
#!/usr/bin/perl -w use DBI; my $dsn = 'dbi:mysql:deClass:localhost:3306'; my $user = 'somebody'; my $pass = 'someword'; my $dbh = DBI->connect($dsn, $user, $pass) or die "Cant connect to the DB: $DBI::errstr\n"; my $exp_time2 = time()-86400; my $sth = $dbh->prepare('delete from cl_items WHERE date_time < $exp_time2 '); $sth->execute(); _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]