April 20, 200916 yr Hi there, I have a script which creates a new Filemaker record with automatically generated password. I want to grab the password from the DB and include it in an email that goes to the subscriber. Please see code below. After calling FMNew to create the new DB record and generate the password I have called FMFind to search for the record but I keep getting no records found so cant get the password from the DB to show in the email. Any assistance gratefully received. <?php include_once('FX/FX.php'); include_once('FX/server_data.php'); $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $newsurvey = new FX($serverIP,$webCompanionPort); $newsurvey -> SetDBData('OOHC_Education_Survey_2008.fp7', 'OOHC_and_LC_Survey_2009'); $newsurvey -> SetDBPassword($webPW, $webUN); $newsurvey-> AddDBParam('Email_Address', $email); $newsurvey -> AddDBParam('First_Name', $firstname); $newsurvey -> AddDBParam('Last_Name', $lastname); $newsurveyResult = $newsurvey -> FMNew(); echo $newsurveyResult['errorCode']; $newsurveyData = current($newsurveyResult['data']); $findsurvey = new FX($serverIP,$webCompanionPort); $findsurvey -> SetDBData('OOHC_Education_Survey_2008.fp7', 'OOHC_and_LC_Survey_2009'); $findsurvey -> SetDBPassword($webPW, $webUN); $findsurvey -> AddDBParam('Email_Address', $email); $findsurvey -> AddDBParam('First_Name', $firstname); $findsurvey -> AddDBParam('Last_Name', $lastname); $findsurveyResult=$findsurvey->FMFind(); $returnedCount=$findsurveyResult['foundCount']; echo $findsurveyResult['errorCode']; foreach($findsurveyResult['data'] as $key=>$findsurveyData); $password = $findsurveyData['Password'][0]; $to = '[email protected]'; $subject = "Survey Entry: $firstname $lastname"; $msg = "The survey database has received a new or updated entry:n"; $headers = 'From: [email protected]'; mail($to, $subject, $msg , $headers, '[email protected]'); $subject = "OOHC and Leaving Care Survey 2009: $firstname $lastname"; $msg = wordwrap($msg, 70); $msg = "Dear $firstnamen"; $msg .= "n"; $msg .= "Thank you for participating in this survey. Please go to http://www.acwa.asn.au/survey3.php to login.n"; $msg .= "n"; $msg .= "Your username is your email address: $email.n"; $msg .= "Your password is: $password.n"; $msg .= "n"; $msg .= "If you require further assistance please contact me on 02 9281 8822.n"; $msg .= "n"; $msg .= "Yours sincerelyn"; $msg .= "Sylvia Ghalyn"; $msg .= "Manager, Policy and Membershipn"; $headers = 'From: [email protected]'. "rn" . 'Reply-To: [email protected]' . "rn" . 'X-Mailer: PHP/' . phpversion(); mail($email, $subject, $msg , $headers); ?>
Create an account or sign in to comment