------------------------------------------------
On Wed, 27 Aug 2003 09:25:03 -0500, "Dan Muey" <[EMAIL PROTECTED]> wrote:

> 
> 
> > Hello Fellow Members,
> 
> Howdy
> 
> > 
> > I am new to perl and Mysql. I want to set up a mysql table to 
> > take Email addresses, and randomly place them into a payment 
> > button from PayPal, and StormPay.
> > 
> > Can anyone tell me how to write the script to setup the MySql 
> > Table to do this.
> > 
> 
> Sure, you need to be familiar with the DBI module first off.
> 
> Create your table and a user to SELECT from it.
> 
> Look at the examples in perldoc DBI for how to do a multiple row SLEECT query.
> Get the query : SELECT Email from PayPalAccounts into an array, say @PPEmail
> 
>  then grab one at random like so:
>  my $email = $PPEmail[rand @PPEmail];
> 
>  print qq(<input type="hidden" name="Account" value="$email">\n);
> 

Though Dan's method is probably more portable, MySQL (3.23+) has a RAND function for 
selecting a random set when used with an ORDER BY and a LIMIT, which will be more 
efficient and less memory intensive than selecting all rows for larger datasets. Check 
the MySQL docs. 

Then you apply the same DBI methods Dan mentioned though don't have to worry about 
randomizing them, etc.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to