I have just recently discovered the wonderful world of functions to make my life easier. I am trying to create a function that sends an email to certain people from a database.
I call the function in my website like this.
I feel the error lies in where i call the function, it just doesn't look right to me.
Any help is appreciated. Thanks!
Code:
function sendEmail($email,$random)
{
//mysql query here
while($row = mysql_fetch_array($result))
{
$id = $row['id'];
$random = $row['random'];
$email = $row['email'];
// subject
$subject =
// message
$message = "";
mail($email, $subject, $message);
}
}
I call the function in my website like this.
Code:
sendEmail($email,$random);
Any help is appreciated. Thanks!