PHP/MySQL Question: Easy 10 points!?

I Love Ubuntu

New member
i have a subscribe to reminder button that adds an e-mail address to a one-column table. I have a cron job running every day that runs a script. I want this script to go through every e-mail address in this table and send a message (that i can construct, I know how to use mail();). The big thing i need help with is looping through the database. The rest I can do.

Thanks,
II
 
I'm not familar with the mail() function really, however you'd accomplish the 'looping' by doing something akin to this (from code I have made):

$query = "SELECT tutid,authid,catid,title,tutdesc, hits FROM tutorials WHERE catid=$getcatid ORDER BY tutid DESC";
$result = mysql_query($query) or die('Error : ' . mysql_error());

while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($tutid,$authid,$catid,$title,$desc,$hits) = $row;
}

Although you'd replace the query with your query (perhaps SELECT * FROM subscribers) and replace the 'list' line with you mail function.
 
Back
Top