Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Includes
- include('includes/class/Movie.class.php');
- include('includes/class/Director.class.php');
- include('includes/class/MoviesTable.class.php');
- include('includes/class/DirectorsTable.class.php');
- //Evaluate string
- if($targetNumeric == true)
- {
- echo "Acabo de confirmar numeric<br>";
- //Loading Movie objects
- $movie = new MoviesTable;
- //Title search
- $movie->title=$target;
- $rstGetByTitle = $movie->getByTitle();
- //Year search
- $movie->year=$target;
- $rstGetByYear = $movie->getByYear();
- echo "<br>Resultado bsuqeuda por año<br>";
- var_dump($rstGetByYear);
- //Loading Director objects
- $director = new DirectorsTable;
- //Birthday search
- $director->birthday=$target;
- $rstGetByBirthday = $director->getByBirthday();
- //Evaluating results
- $searchOnMovies = array("title" => $rstGetByTitle,"year" => $rstGetByYear);
- $searchOnDirectors = array("birthday" => $rstGetByBirthday);
- $rstNumericArray = array (
- "movie" => $searchOnMovies,
- "director" => $searchOnDirectors
- );
- echo "<br>Dump de array de resultados por categorias<br>";
- var_dump($rstNumericArray);
- foreach($rstNumericArray as $searchType => $searchFound)
- {
- foreach ($searchFound as $category => $targetFound)
- {
- $rstRowsArray = $targetFound->num_rows;
- echo "<br>Estoy mostrando el numero de filas<br>";
- var_dump($rstRowsArray);
- if(empty($rstRowsArray))
- {
- echo "<br>Estoy dando nulo porque soy subnormal<br>";
- }
- else
- {
- echo "<p>Se han encontrado resultados en el apartado <h2>".$searchType."</h2></p>";
- for($i=0;$i<count($rstRowsArray);$i++)
- {
- echo "<p>Categoría: ".$category."</p>";
- $rstRow=$targetFound->fetch_assoc();
- foreach($rstRow as $index => $foundData)
- {
- echo $index." : ".$foundData."<br>";
- }
- }
- }
- }
- }
- }
- else
- {
- //Loading Movie objects
- $movie = new MoviesTable;
- //Title search
- $movie->title=$target;
- $rstGetByTitle = $movie->getByTitle();
- //Genre search
- $movie->genre=$target;
- $rstGetByGenre = $movie->getByGenre();
- //Loading Director objects
- $director = new DirectorsTable;
- //Name search
- $director->name=$target;
- $rstGetByName = $director->getByName();
- //Surname search
- $director->last_name=$target;
- $rstGetByLastName = $director->getByLast_name();
- //Evaluating results
- $searchOnMovies = array("title" => $rstGetByTitle,"genre" => $rstGetByGenre);
- $searchOnDirectors = array("name" => $rstGetByName, "last_name" => $rstGetByLast_name);
- $rstNotNumericArray = array (
- "movie" => $searchOnMovies,
- "director" => $searchOnDirectors
- );
- echo "<br>Dump de array de resultados por categorias<br>";
- var_dump($rstNumericArray);
- foreach($rstNotNumericArray as $searchType => $searchFound)
- {
- foreach ($searchFound as $category => $targetFound)
- {
- $rstRowsArray = $targetFound->num_rows;
- echo "<br>Estoy mostrando el numero de filas<br>";
- var_dump($rstRowsArray);
- if(empty($rstRowsArray))
- {
- echo "<br>Estoy dando nulo porque soy subnormal<br>";
- }
- else
- {
- echo "<p>Se han encontrado resultados en el apartado <h2>".$searchType."</h2></p>";
- for($i=0;$i<count($rstRowsArray);$i++)
- {
- echo "<p>Categoría: ".$category."</p>";
- $rstRow=$targetFound->fetch_assoc();
- foreach($rstRow as $index => $foundData)
- {
- echo $index." : ".$foundData."<br>";
- }
- }
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment