I’m trying to create a page that communicates with my CRM to allow a custom to check the status of their account. Here’s what I’ve created so far but every time I get the last echo (which I shouldn’t), and that tellsme something isn’t being passed to the next correctly.
I know you guys are brilliant and can help me out.
[php]<?php
$hostname = “it is a secret”;
$username = “it is a secret”;
$password = “it is a secret”;
$email = $_POST[“Email”]; //comes from HTML form on previous page
//connect to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die(“Unable to connect”);
echo “Connected
”;
//select a database to work with
$selected = mysql_select_db(“it is a secret”,$dbhandle)
or die(“Could not select database”);
echo “Selected Database
”;
//match submitted email to email in database and get record id number
$setemail = mysql_query(“SELECT id FROM email_addresses WHERE email_address=’$Email’”)
or die(“Could not select Email Addresses”);
echo “Email Address Found
”;
$setemailname = mysql_fetch_assoc($setemail);
//get record id of email and relate to record id of account in database
$setuser = mysql_query(“SELECT id FROM email_addr_bean_rel WHERE bean_id=’$setemailname’”)
or die(“Could not select Email Address Bean Relate”);
echo “Related Bean Found
”;
$setusername = mysql_fetch_assoc($setuser);
//get account status of account id in database
$result = mysql_query(“SELECT status_c FROM accounts_cstm WHERE id_c=’$setusername’”)
or die(“Could not select Accounts_cstm”);
echo “Status found
”;
$status = mysql_fetch_assoc($result);
//return appropriate response
if ($status == ‘PendingMR’) {
echo “We are missing some information from you. Please call us.”;
} elseif ($status == ‘Lead’) {
echo “You have not completed your application. Please visit www.com”;
} elseif ($status == ‘Waiting’) {
echo “We have received all of your information and are processing your account request.”;
} elseif ($status == ‘CreditRev’) {
echo “It looks like we need additional information to complete the setup of your account.”;
} elseif ($status == ‘SetupPending’) {
echo “We have shipped your equipment and emails your user login info.”;
} elseif ($status == ‘SetupComplete’) {
echo “You have already received your equipment and user login info.”;
} elseif ($status == ‘Closed’) {
echo “Your account has been closed”;
} elseif ($status == ‘Declined’) {
echo “We’re sorry! We were unable to set you up.”;
} elseif ($status == ‘Incomplete’) {
echo “It looks like we need additional information to complete the setup of your account.”;
} elseif ($status == ‘Withdrawn’) {
echo “It looks like you told us to cancel your application before we could finish processing it.”;
} else {
echo “It looks like we’re having trouble finding you. Please contact us so we can get some more information.”;
}
?>
[/php]