Forum Moderators: coopster
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? ;)
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.