I'm a teach myself novice dev and have been playing around with this problem for the past 6 hours. Any help is appreciated.
Business Objective -
My website sends automated emails based on a specific action or event.
When the event has occurred, the code needs to pull the user email address from MySQL DB and use as the address for the email.
In this particular code, I am sending 3 emails (1 to each user, and 1 to admin). 2 work, 1 doesn't. I'll show the code for the one that doesn't.
I've narrowed it down to the code not identifying the user_email.
I'll post the code at the bottom of this post but want to ensure context is clear.
In the Database there are 2 sections (offers, and users)
What it needs to do is use the variable 'Offer_id' to identify the 'agent_id', which then is the same as 'id' and allows me to reference the correct user_email.
A million thank yous in advance for saving my sleep
Code below is for the one that doesn't:
Code: Select all
$option = $_REQUEST["option"];
$action = $_REQUEST["action"];
$offer_id = $_REQUEST["offer_id"];
if ($action == 'A') {
$sqlaction = "update offers set accept_ind = 'A' where offer_id = '$offer_id' ";
$rowresult = mysql_query($sqlaction);
// Notify Agent Offer has been accepted
// ************************************
$offer_id = $_REQUEST["offer_id"];
$getAgentId = mysql_query("SELECT agent_id FROM offers WHERE offer_id = '$offer_id' ");
$resultAgentId = mysql_fetch_array($getAgentId);
$agentId = $resultAgentId['agent_id'];
$getAgentEmail = mysql_query("SELECT user_email FROM users WHERE id = '$agentId' ");
$resultAgentEmail = mysql_fetch_array($getAgentEmail);
$agentEmail = $resultAgentEmail['user_email'];