Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: Re: Re: Re: Apache::DBI, DBI, DBD::MySql and MySQL cache?

by Flame (Deacon)
on Mar 17, 2003 at 21:55 UTC ( #243815=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Re: Apache::DBI, DBI, DBD::MySql and MySQL cache?
in thread Apache::DBI, DBI, DBD::MySql and MySQL cache?

Hmm, your quote from the MySQL manual seems to work. Only I'm twisting it a little to use RAND(?) and I pass a Perl-generated rand :) It's still not quite as random as I would like, but it's definately better. As to the console select statement test, sorry but that failed (diff number each time), but with perl passing different rand numbers most of the time, it's interesting at least.

Modified Code:
my $sth = $state->{'DBH'}->prepare('SELECT quote,author FROM quotes + ORDER BY RAND(?) LIMIT 1'); $sth->execute(rand(10000)); my $row = $sth->fetchrow_arrayref; $sth->finish;

My code doesn't have bugs, it just develops random features.

Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://243815]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-09-30 09:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found