I am having some difficultly getting this to work. I want to check to see if a record exists in the memusers table. If it does send and email. If it does not, add to a table. Am I simply overlooking something? Thanks!
//********** Check if specific record exists ************
global $conn;
$strSQLExists = "select * from memusers where Email='".$values["Email"]."'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
//********** Send email with new data ************
$email='".$values["Email"]."';
$from="admin@test.com";
$msg="Welcome!";
$subject="Welcome!";
foreach($values as $field=>$value)
{
if(!IsBinaryType($pageObject->pSet->getFieldType($field)))
$msg.= $field." : ".$value."
";
}
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}
else
{
$strSQLInsert = "insert into memusers(Email, AccessType) values ('".$values["Email"]."','".$values["Accesstype"]."')";
CustomQuery($strSQLInsert);
}
return true;