powerhouse has asked for the wisdom of the Perl Monks concerning the following question:
sub Get_Banner_Rotator { my ($row, $dbh, $sth, $html_content); $sth = $dbh->prepare (qq{ SELECT * FROM Banner_Rotator ORDER BY RA +ND() LIMIT 1 }); $sth->execute(); $row = $sth->fetchrow_hashref(); if (defined($row) && $row ne "") { $html_content = qq~Print the link and image~; } $html_content =~ s/{{imageurl}}/$imageurl/g; return($html_content); }
"SELECT id FROM table WHERE u = '1' ORDER BY RAND() LIMIT 1"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl and MySQL - getting a random record
by Coruscate (Sexton) on Feb 05, 2003 at 21:56 UTC | |
by powerhouse (Friar) on Feb 06, 2003 at 00:47 UTC | |
|
Re: Perl and MySQL - getting a random record
by Cody Pendant (Prior) on Feb 05, 2003 at 22:07 UTC | |
|
Re: Perl and MySQL - getting a random record
by tstock (Curate) on Feb 06, 2003 at 06:51 UTC | |
|
Re: Perl and MySQL - getting a random record
by Abigail-II (Bishop) on Feb 05, 2003 at 23:48 UTC | |
by powerhouse (Friar) on Feb 06, 2003 at 00:36 UTC | |
by Abigail-II (Bishop) on Feb 06, 2003 at 00:42 UTC | |
|