Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by Flame (Deacon)
on Mar 17, 2003 at 21:55 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2024-04-18 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found