• JoshuaSpice
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

I have a chunk of code that works perfectly when querying the database once.  But, when I throw in a second query, I don't get any results.

 


$sfConnection = new SforcePartnerClient(); $mySoapClient = $sfConnection->createConnection(SALESFORCE_WSDL); $login = $sfConnection->login(SALESFORCE_USER, SALESFORCE_PASS);//$_POST['intUser'], $_POST['intPass']); $result = $login->userInfo; // Get account listing $qstr = "select Name,Industry,Id,Phone from Account where Name!='false'"; // Check for where filters by the length of the variable if(strlen($_POST['Userkey']) > 0) $qstr .= " and Name = '" . $_POST['Userkey'] . "'"; if(strlen($_POST['Password']) > 0) $qstr .= " and Site = '" . $_POST['Password'] . "'"; if(strlen($_POST['Status']) > 0) $qstr .= " and Industry = '" . $_POST['Status'] . "'"; if(strlen($_POST['FirstName']) > 0) $qstr .= " and FirstName = '" . $_POST['FirstName'] . "'"; if(strlen($_POST['LastName']) > 0) $qstr .= " and LastName = '" . $_POST['LastName'] . "'"; if(strlen($_POST['AccountID']) > 0) $qstr .= " and Type = '" . $_POST['AccountID'] . "'"; if(strlen($_POST['SecondaryPhone']) > 0) $qstr .= " and Rating = '" . $_POST['SecondaryPhone'] . "'"; if(strlen($_POST['PrimaryPhone']) > 0) $qstr .= " and Phone = '" . $_POST['PrimaryPhone'] . "'"; if(strlen($_POST['Fax']) > 0) $qstr .= " and Fax = '" . $_POST['Fax'] . "'"; if(strlen($_POST['Address1']) > 0) $qstr .= " and ShippingStreet = '" . $_POST['Address1'] . "'"; if(strlen($_POST['City']) > 0) $qstr .= " and ShippingCity = '" . $_POST['City'] . "'"; if(strlen($_POST['Region']) > 0) $qstr .= " and ShippingState = '" . $_POST['Region'] . "'"; if(strlen($_POST['PostalCode']) > 0) $qstr .= " and ShippingPostalCode = '" . $_POST['PostalCode'] . "'"; if(strlen($_POST['Country']) > 0) $qstr .= " and ShippingCountry = '" . $_POST['Country'] . "'"; // Query $accounts = $sfConnection->query($qstr); $records = $accounts->records; $qstr = "select Contact.Account.Name,Contact.Account.Industry,AccountId,Phone from Contact where Contact.FirstName!='false'"; // Check for where filters by the length of the variable if(strlen($_POST['Userkey']) > 0) $qstr .= " and Contact.Account.Name = '" . $_POST['Userkey'] . "'"; if(strlen($_POST['Password']) > 0) $qstr .= " and Site = '" . $_POST['Password'] . "'"; if(strlen($_POST['Status']) > 0) $qstr .= " and Industry = '" . $_POST['Status'] . "'"; if(strlen($_POST['FirstName']) > 0) $qstr .= " and FirstName = '" . $_POST['FirstName'] . "'"; if(strlen($_POST['LastName']) > 0) $qstr .= " and LastName = '" . $_POST['LastName'] . "'"; if(strlen($_POST['AccountID']) > 0) $qstr .= " and Type = '" . $_POST['AccountID'] . "'"; if(strlen($_POST['SecondaryPhone']) > 0) $qstr .= " and Rating = '" . $_POST['SecondaryPhone'] . "'"; if(strlen($_POST['PrimaryPhone']) > 0) $qstr .= " and Phone = '" . $_POST['PrimaryPhone'] . "'"; if(strlen($_POST['Fax']) > 0) $qstr .= " and Fax = '" . $_POST['Fax'] . "'"; if(strlen($_POST['Address1']) > 0) $qstr .= " and ShippingStreet = '" . $_POST['Address1'] . "'"; if(strlen($_POST['City']) > 0) $qstr .= " and ShippingCity = '" . $_POST['City'] . "'"; if(strlen($_POST['Region']) > 0) $qstr .= " and ShippingState = '" . $_POST['Region'] . "'"; if(strlen($_POST['PostalCode']) > 0) $qstr .= " and ShippingPostalCode = '" . $_POST['PostalCode'] . "'"; if(strlen($_POST['Country']) > 0) $qstr .= " and ShippingCountry = '" . $_POST['Country'] . "'"; // Query $accounts = $sfConnection->queryall($qstr); $records .= $accounts->records;

 


Any help would be appreciated.  Thanks.