storeEmail
This commit is contained in:
@ -73,6 +73,7 @@ try
|
||||
if($ret)
|
||||
{
|
||||
$result = new CMsg(1, 200, "Email send successfully.");
|
||||
$storeResult = storeEmail();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -85,4 +86,20 @@ catch (Exception $e)
|
||||
$result = new CMsg(0, 500, $e->getMessage() );
|
||||
echo $result->jsonarray();
|
||||
}
|
||||
|
||||
|
||||
function storeEmail()
|
||||
{
|
||||
global $qr_id, $conn, $msg, $fromEmail;
|
||||
|
||||
$dogRes = getDogByQrId($qr_id, $conn);
|
||||
|
||||
if($dogRes->success)
|
||||
{
|
||||
$sql = "INSERT INTO contact_email (dogs_id, from_email, msg) VALUES (?,?,?)";
|
||||
$conn->prepare($sql)->execute([$dogRes->data->id, $fromEmail, $msg]); // throw PDO::exception when failed
|
||||
}
|
||||
|
||||
return $dogRes;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user