我有一个带有MySQL查询的Perl脚本,如下所示
my $date = strftime "%Y-%m-%d", localtime;
my $db_passwdcol = "password";
my $db_table = "users";
my $db_usercol = "username";
my $db_cond = "expire_date";
my $sql_query = "SELECT $db_passwdcol FROM $db_table WHERE $db_usercol = ?" . ($db_cond gt $date ? ");
我想要做的是使用SQL查询将当前值与过期日期进行比较。我尝试了许多变化,但无望。
提前致谢,
答案 0 :(得分:1)
更改sql查询字符串,如下所示;
$sql_query = "SELECT $db_passwdcol FROM $db_table WHERE $db_usercol = ? AND $db_cond > NOW()";
最佳,