exec('SET NAMES utf8'); $statement2 = $connection2->prepare("SELECT * FROM idbotwindows"); $statement2->execute([$getIdBotWindows]); $isIdBotWin = false; foreach($statement2 as $row){ if (preg_match("/$getIdBotWindows/",$row['idbot'])){ $isIdBotWin=true; } } if($isIdBotWin){ echo "exist"; }else{ echo "no"; } ?>