The code below selects all results whose thumbnail of the video has not yet been created and if it was not, it creates a new one, but I'm getting an error that I can not 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 supposed to be generating the error, the while runs normally, but when I add the same I get this error:
Fatal error: Call to a member function fetch () on string in