Dear all,
I have (finally) updated the PHP version on my site, but I've got loads of old scripts, so I'm working to update them one at a time.
Most of the changes, of course, are updating from mysql codes to mysqli.
The first one I'm working on runs a cron job to hit one of my databases, grab info, and then send an email with the info to folks whose email addresses are on a list from another database.
While testing, I've temporarily updated the cron to run every minute and I've removed all users' email addresses except my own.
I updated the code and it actually works perfectly; in other words, I am getting the email (subject "Musicians of the Day"), formatted correctly with the correct information.
However, I am also getting a Cron Daemon email (more specifics on this in a moment.....)
The relevant part of the code is here (if you need more context, let me know, please):
PHP Code:
while($row = mysqli_fetch_assoc($eprep)) {
$email = $row[email];
mb_language("uni");
$message1 = mb_convert_encoding($message1, "UTF-8");
$message2 = mb_convert_encoding($message2, "UTF-8");
$message3 = mb_convert_encoding($message3, "UTF-8");
mb_send_mail ("$email","Musicians of the Day","$messagestart $message1 $message2 $message3 $messagestop","$headers");
};
?>
The issue is with line 145, which is:
$email = $row[email];
If I leave it as is, the Cron Daemon says that it's a "Use of undefined constant email - assumed 'email' (this will throw an Error in a future version of PHP)"
My initial thought was that I needed the quote marks now:
$email = $row['email'];
which still gets me a Cron Daemon email, but one which is literally blank.
I imagine this is a really simple thing to fix, but I'm currently stumped. Have tried many things, none of which are worth going over here.
Thoughts?