This topic is locked

Email user

6/5/2008 7:28:13 PM
PHPRunner General questions
P
pnutz author

I need the user that input the record into the database to receive a email when changes are made to that record by someone else
global $conn;

$rs = db_query("select * from login where username='".$_SESSION["UserID"]."'", $conn);

$data = db_fetch_array($rs);

$_SESSION["userEmail"] = $data["Email"];

// Compare old and new values. If value has changed add user ID and Updated Field Text

foreach ($values as $key => $value)

{if ($value!=$oldvalues[$key])

$message .= $key . ": " . $value . " Edited by:".$_SESSION["UserID"]." Updated Field \n";

else

$message .= $key . ": " . $value . "\n";

}

$email="test@test.com".", ".$_SESSION["userEmail"];

$subject="Field Update";

mail($email, $subject, $message);

return true;
now this will only email the static account and the person logged in for this session
I need to pull the email from the user id for the record or pull from a table
any help would be greatly appreciated

J
Jane 6/6/2008

Hi,
I'm not sure that I understand you correctly.

You've pulled actual email from login table. Do you have another emails in another tables?

P
pnutz author 6/6/2008

Hi,

I'm not sure that I understand you correctly.

You've pulled actual email from login table. Do you have another emails in another tables?


yes I need to pull a email from another table ...currently it sends a email from ($email="test@test.com".", ".$_SESSION["userEmail"];

I have other users update data in the record ....and this will only send a email to them and the static account not the owner of the record.

now test@test.com is static and the other is pulling the email from the user that is currently logged in (sessionID.....what I need is for the email address to come from the user that created the record
so the user who put data into the record originally and their ID is associated to that record needs to get a email as well ...
I hope this clears things up...

J
Jane 6/7/2008

Hi,
here is a sample:

$rs2 = db_query("select * from login where ID='".$values["UserID"]."'", $conn);

$data2 = db_fetch_array($rs2);

$_SESSION["userEmail2"] = $data2["Email"];


where UserID and ID is your actual field names.