Exemplo n.º 1
0
/**
 * This function takes in firstname and lastname of an actor and 
 * first checks to see if there are multiple actors with same name.
 * if so it calls the getSimilarActorIdByName function which selects
 * which Id gets pickes based on two filtering criteria. If there are
 * no entries it returns null and if there is only a single entry it
 * returns the Id of that actor using getActorIdByName.
 * @param String $Fname
 * @param String $Lname
 * @return NULL| Integer
 */
function getMyId($Fname, $Lname)
{
    if (searchForDuplicateActor($Fname, $Lname) == true) {
        return getSimilarActorIdByName($Fname, $Lname);
    } elseif (getActorIdByName($Fname, $Lname) == null) {
        return null;
    } else {
        return getActorIdByName($Fname, $Lname);
    }
}
Exemplo n.º 2
0
include "search-engine.php";
?>

	<h1>Results for <?php 
echo $Fname . " " . $Lname;
?>
</h1>

<?php 
//First search if given actor has multiple entries in actor table
if (searchForDuplicateActor($Fname, $Lname)) {
    //if so, pick the one with highest movie count and lowest id number
    $actorId = getSimilarActorIdByName($Fname, $Lname);
} else {
    //else get the id of the actor directly
    $actorId = getActorIdByName($Fname, $Lname);
}
//if no actors with given name found, return null
if ($actorId == null) {
    ?>
		Actor <?php 
    echo $Fname . " " . $Lname;
    ?>
 not found.
<?php 
} else {
    //otherwise populate the result table using template
    $result = getMovieList($actorId);
    include "search-table.html";
}
?>