Пример #1
0
 public function loadArrayByrelationship($searchTerm)
 {
     $returnvalue = array();
     $operator = "=";
     // change to a like search if a wildcard character is present
     if (!(strpos($searchTerm, "%") === false)) {
         $operator = "like";
     }
     if (!(strpos($searchTerm, "_") === false)) {
         $operator = "like";
     }
     $sql = "SELECT agentrelationsid FROM agentrelations WHERE relationship {$operator} '{$searchTerm}'";
     $preparedsql = "SELECT agentrelationsid FROM agentrelations WHERE relationship {$operator} ? ";
     if ($statement = $this->conn->prepare($preparedsql)) {
         $statement->bind_param("s", $searchTerm);
         $statement->execute();
         $statement->bind_result($id);
         while ($statement->fetch()) {
             $obj = new agentrelations();
             $obj->load($id);
             $returnvalue[] = $obj;
         }
         $statement->close();
     }
     return $returnvalue;
 }
Пример #2
0
function loadAgentRelations()
{
    $al = null;
    $alid = preg_replace('[^0-9]', '', array_key_exists("agentrelationsid", $_REQUEST) ? $_REQUEST["agentrelationsid"] : "");
    if (strlen($alid) > 0) {
        $al = new agentrelations();
        $al->load($alid);
    } else {
        throw new Exception("No agent relationships record specified.");
    }
    return $al;
}