update function tittleFilmData()

added DISTINCT clause to avoid duplicates in the query
This commit is contained in:
Daniel Muñoz Garcia 2021-04-13 15:45:57 +02:00 committed by GitHub
parent 5a5a99ad80
commit 9e9661e4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,14 +65,13 @@
$tittle,$duration,$language, $description,$id); $tittle,$duration,$language, $description,$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul; return $resul;
} }
//Returns a query to get all films tittles. //Returns a query to get all films tittles.
public function tittleFilmData(){ public function tittleFilmData(){
$sql = sprintf( "SELECT tittle FROM film "); $sql = sprintf( "SELECT DISTINCT tittle FROM film ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul; return $resul;