Try this. It's from Jump.pm
my $db = $DB->table('Links');
my $total = $db->total() - $db->count({ isValidated => 'No' });
my $offset = int rand $total;
$db->select_options ("LIMIT $offset, 1");
my $sth = $db->select ( { isValidated => 'Yes'} , ['ID']);
my ($id) = $sth->fetchrow_array;
return ($id);
}
It doesn't rely on the RAND function in queries.
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.
Code:
sub { my $db = $DB->table('Links');
my $total = $db->total() - $db->count({ isValidated => 'No' });
my $offset = int rand $total;
$db->select_options ("LIMIT $offset, 1");
my $sth = $db->select ( { isValidated => 'Yes'} , ['ID']);
my ($id) = $sth->fetchrow_array;
return ($id);
}
It doesn't rely on the RAND function in queries.
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.