-2
The code below selects all the results whose thumbnail of the video has not yet been created and if it has not been, it creates a new one, but I am getting an error that I cannot find the solution:
$video = BD::conn()->prepare("SELECT * FROM episodios WHERE thumb = '0' OR thumb = ''");
$video->execute();
$c = $video->rowCount();
if($c >= 1){
while($dados = $video->fetch()){
$id = $dados["id"];
$serie = $dados["id_serie"];
$temporada = $dados["temporada"];
$episodio = $dados["episodio"];
if (!is_dir("D:/thumbs/".$serie)) {
mkdir("D:/thumbs/".$serie, 0777);
}
if (!is_dir("D:/thumbs/".$serie."/".$temporada)) {
mkdir("D:/thumbs/".$serie."/".$temporada, 0777);
}
/*o erro está sendo gerado aqui*/
if(is_dir("D:/videos/".$anime."/original/")) {
$video = "D:/videos/".$serie."/original/".$temporada."/".$episodio.".mp4";
}else{
$video = "D:/videos/".$anime."/dublado/".$temporada."/".$episodio.".mp4";
}
/*fim da parte com erro*/
}
}
When I comment on the block that is supposedly generating the error, while normally goes through, but when I add the same I get this error:
Fatal error: Call to a Member Function fetch() on string in
its variable
$video
is a string and not an object.– RFL