Forum Moderators: coopster

Message Too Old, No Replies

Info needed-Email sent to people with random numbers

How to create script?

         

murlis

3:46 pm on Mar 15, 2006 (gmt 0)



Hi!

I need to build script that would receive data from form (name, email) and will send to that email message like: "Hi! Congrats! You have received our special discount, please use the code "random number"!" I am quite new to PHP and I have managed to create email sending script but I do not know how to insert the number generator in email sending script. Sounds stupid? ;)

trader

3:58 pm on Mar 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not at all stupid.

I have been looking with zero success for ages to find a way to randomly pick a website from a long list of url's and call it the random website pick of the day.

After many hrs of Googling it I have given up looking.

jatar_k

5:05 pm on Mar 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld murlis,

as trader said, not stupid at all

I can also answer both of your questions.

murlis

[php.net...]

the above function will return a random number within a range. If you want this to always be different then you will need to store the ones that were already used and then check to see if it is truly different every time you send an email. If you don't care then just let her roll.

trader

[dev.mysql.com...]

use RAND() against the id in the table to select a random site. Again, if you want them to be continually different then you need to track it somehow. You could possibly add another column to know whether that site has been on the front page within a set time period and then you could just select RAND from sites that don't have that column set.