Andy,
maybe you or someone would have an idea on this. Once I have the link, I need to loop until I have a valid link. I keep getting server errors and don't quite see where I'm off.
Lance
# If we are chosing a random link, then get the total and go to one at random.
if (lc $id eq "random") {
# loop through, grabbing a new random ID until we found a link that is randomable
while (length($goto)= 0) {
my $offset = int rand $links->count(VIEWABLE);
$links->select_options("LIMIT 1 OFFSET $offset");
my $sth = $links->select(qw/ID URL/ => VIEWABLE, GT::SQL::Condition->new('isRandomable','=','Yes') );
($id, $goto) = $sth->fetchrow_array;
}
}
maybe you or someone would have an idea on this. Once I have the link, I need to loop until I have a valid link. I keep getting server errors and don't quite see where I'm off.
Lance
Code:
# If we are chosing a random link, then get the total and go to one at random.
if (lc $id eq "random") {
# loop through, grabbing a new random ID until we found a link that is randomable
while (length($goto)= 0) {
my $offset = int rand $links->count(VIEWABLE);
$links->select_options("LIMIT 1 OFFSET $offset");
my $sth = $links->select(qw/ID URL/ => VIEWABLE, GT::SQL::Condition->new('isRandomable','=','Yes') );
($id, $goto) = $sth->fetchrow_array;
}
}