Looking at all that code you already wrote, you're not that much of a
newbie.
Read up on functions. (A function is merely the same code you already run
but it's set aside, out of the main execution path of your script, so that
you can call it from anyplace that you need to execute that particular set
of code.) Put the function's code near the top of your script. Say you
named your function SendAnEmail. Call it when you need by typing a line
that reads SendAnEmail();.
You might want to read up on arguments when learning about functions. Then
you could have a couple of them in your function that would allow you to
pass specific info regarding the email you're sending, such as a timestamp
for when the email was triggered, who triggered perhaps, what record key was
changed. Things like that. Then you'd have a function header like:
function SendAnEmail($when,$who,$key)
and when you called the function you simply type
SendAnEmail($a,$b,$c) where $a is the datetime var you have for when it is,
$b is the user who did it, and $c is the key that you updated. In the
function those would be represented by the var names you use in the function
header and you can then put them in your email code where you want them to
show up. For ex., your email message might read like this:
At $when an update was performed by $who to the record with the key of
$key.
That's enough to get you going - much more than I intended.
(rest deleted for brevity's sake :) )
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php