storeEmail

This commit is contained in:
Peter Hoppe
2023-02-07 15:56:46 +01:00
parent 37977c6066
commit adfbe17f38
8 changed files with 159 additions and 113 deletions

View File

@ -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;
}
?>