Gossamer Forum
Home : Products : DBMan : Customization :

Almost got random record of the day working.. need a little help

Quote Reply
Almost got random record of the day working.. need a little help
<Updated>
Here's what I have put in sub html_home. I am using the num_records mod by Eliot, www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001547.html , with a slight modification of return $count instead of print $count.

Code:
$count = num_records;
srand;
$find = 0; $rand = int (rand ($count + 0.5)); ($rand == $count) and ($rand--);

and then in the body of the page (not in a print statement):

Code:
&html_record(&get_record($rand));

It does indeed get and print out a random record, but clicking on the link generates an internal server error I think because I'm not passing the right information (the full URL that results is /cgi-bin/db.cgi?db=default&uid=default&nh=-1&mh=1). A little help?


[This message has been edited by oldmoney (edited December 22, 1999).]
Quote Reply
Re: Almost got random record of the day working.. need a little help In reply to
Various perl documentation says that you shouldn't call srand twice in the same program.

------------------
WFMY-TV Webmaster
Quote Reply
Re: Almost got random record of the day working.. need a little help In reply to
Didn't know that (you learn something new everyday)... but I don't think that is the problem I'm having. The value $rand is working... it's just passing that to &html_record in the right form I'm puzzling over.
Quote Reply
Re: Almost got random record of the day working.. need a little help In reply to
Can we see a URL to know better what is happening?

------------------
WFMY-TV Webmaster