功能因行删除而中途中断?

时间:2015-06-29 11:24:32

标签: php pdo sql-delete

我似乎无法弄清楚发生了什么!该脚本运行完美,直到文件必须删除。

function myFunction($db) {
            if (isset($_POST['deleteProject'])) {
                $stmtOne = $db->prepare('DELETE FROM projects WHERE title =  :title');
                $stmtOne->execute([
                    'title' => str_replace('+', ' ', $_GET['project'])
                ]);

                $stmtTwo = $db->prepare('SELECT * FROM projects WHERE title = :title');
                $stmtTwo = $db->execute([
                    'title' => str_replace('+', ' ', $_GET['project'])
                ]);

                foreach ($stmtTwo as $row) {
                    $files = glob('project_images/'.$row['id'].'{,.}*', GLOB_BRACE);
                    foreach($files as $file) {
                        if(is_file($file))
                        unlink($file);
                    }
                }
                header ('Location: cms.php?delete=t');
            }

我的问题是;由于行的删除,此功能是否中断?或者是由于错误的代码?我不确定我能尝试什么。

0 个答案:

没有答案