in reply to sth fetch only grabbing back first result
my $data = qq(SELECT search, engine, time FROM searches WHERE DATE_SUB ++(CURDATE(),INTERVAL 7 DAY) <= time); my $ref = $dbh->selectall_arrayref($data); # For fun you can even check the number of rows returned print "Total Searches: ". ($#{$ref} + 1) ."<br>\n"; for my $row (0 .. $#{$ref}) { print "$ref->[$row][0] $ref->[$row][1] on $ref->[$row][2]<br>\n"; }
This should print out all your data.
Update: I would also ensure that you are comparing like data. Ie, I usually compare time in UNIX_TIMESTAMP() format. Therefore I would change your query to be something like this:
my $data = qq(SELECT search, engine, time FROM searches WHERE UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL 7 DAY)) <= UNIX_TIMESTAMP(time));
Eric
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sth fetch only grabbing back first result
by Anonymous Monk on Aug 10, 2006 at 19:20 UTC | |
by madbombX (Hermit) on Aug 10, 2006 at 19:39 UTC | |
by Ieronim (Friar) on Aug 10, 2006 at 19:43 UTC |