Hello all,
I need to create a new template global function and I needed some help with the sql functions. Basically, I need to write a function that will find the number of new reviews in the last 7 days. Simple enough right? I looked at some perl tutorials and i figured out how to find the date 7 days ago. So that part was easy. THe part im having trouble with is actually querying the db and getting the info back. I'm getting an error and I have no idea why. I basically tried copying the other functions but it still doesnt work. Below is a snippet of the code I am using, where $date is the date 7 days ago.
my $reviews_db = $DB->table('Reviews');
my $count = $reviews_db->select ( { Review_Date => ">$date" }, [ 'COUNT(*)' ] );
return $count;
So, I am trying to execute the query "SELECT count(*) FROM Reviews WHERE Review_Date > '$date'" but I am getting the error "GT::SQL::Driver::MYSQL::sth=HASH(0x84acee0)". I'm a total noob to linksql and perl and I'm betting this is a pretty easy problem to solve so I would really appreciate the help. I've been stuck on this for almost a month now. Thanks in advance!
I need to create a new template global function and I needed some help with the sql functions. Basically, I need to write a function that will find the number of new reviews in the last 7 days. Simple enough right? I looked at some perl tutorials and i figured out how to find the date 7 days ago. So that part was easy. THe part im having trouble with is actually querying the db and getting the info back. I'm getting an error and I have no idea why. I basically tried copying the other functions but it still doesnt work. Below is a snippet of the code I am using, where $date is the date 7 days ago.
my $reviews_db = $DB->table('Reviews');
my $count = $reviews_db->select ( { Review_Date => ">$date" }, [ 'COUNT(*)' ] );
return $count;
So, I am trying to execute the query "SELECT count(*) FROM Reviews WHERE Review_Date > '$date'" but I am getting the error "GT::SQL::Driver::MYSQL::sth=HASH(0x84acee0)". I'm a total noob to linksql and perl and I'm betting this is a pretty easy problem to solve so I would really appreciate the help. I've been stuck on this for almost a month now. Thanks in advance!