Find Record by Email using PHP and Filemaker
Literal Text
All these special symbols might leave you feeling a bit worried: What if you don’t want to discombobulate FileMaker’s finding. Instead, you actually want to find an @ sign? Believe it or not, another symbol comes to the rescue: The “literal text” symbol. Just put your punctuated find criteria in quotes:
“mr_magoo@sixfriedrice.com”
When FileMaker sees those quote marks, it dutifully ignores the symbols inside. In fact, this is just what you should do if you’re searching for an email address.
If @ means “any character” then what does it matter? The
@inmr_magoo@sixfriedrice.comwill happily match the @ sign in the email address, won’t it? Unfortunately, no. The @ sign (when in regular field data) is not indexed. In other words, FileMaker tosses it out when it takes its speed-search notes about your records. So to FileMaker, the email address “mr_magoo@sixfriedrice.com” is really three words: “mr”, “magoo”, and “sixfriedrice.com” So there’s nothing in there for the @ symbol to match. You can prove this yourself: When you need to find an email address, just put a space in place of the @ sign. It will find without a hitch.
Source
<?php
if(isset($_POST['username']))
{
require_once('db_config.php');
$email=$_POST['email'];
$email=str_replace("@", " ", $email);
$request = $fm->newFindCommand('users');
$request->addFindCriterion('Email', $email);
$result = $request->execute();
if (FileMaker::isError($result)) {
$error=$result->getMessage();
header("location:forgotPass.php?err=Email+addess+do+not+exists+in+the+Database.");
exit;
}
$records = $result->getRecords();
//echo "<pre>"; print_r($records); die();
foreach($records as $rs)
{
$email1= $rs->getField('Email');
$user_name= $rs->getField('UserName');
$id=$rs->getField('id');
header("location:forgot_pass_mail.php?uid=".$id);
exit();
}
header("location:forgotPass.php?err=Please+provide+valid+username+and+email.");
exit;
}
else{
header("location:index.php");
exit();
}
?>

0 Responses to “Find Record by Email using PHP and Filemaker”
Leave a Response