function delete_quiz($quiz_id) { //delete questions $query = he_database::placeholder("SELECT `id` FROM `se_he_quiz_question` \r\n WHERE `quiz_id`=?", $quiz_id); $question_ids = he_database::fetch_column($query); he_quiz::delete_questions($question_ids); //delete results $query = he_database::placeholder("SELECT `id` FROM `se_he_quiz_result`\r\n WHERE `quiz_id`=?", $quiz_id); $result_ids = he_database::fetch_column($query); he_quiz::delete_results($result_ids); //delete plays $query = he_database::placeholder("DELETE FROM `se_he_quiz_play`\r\n WHERE `quiz_id`=?", $quiz_id); he_database::query($query); //get quiz photo $query = he_database::placeholder("SELECT `photo` FROM `se_he_quiz`\r\n WHERE `quiz_id`=?", $quiz_id); $photo = he_database::fetch_field($query); if ($photo) { //delete photo @unlink(he_quiz::photo_dir() . $photo); } //delete comments $query = he_database::placeholder("DELETE FROM `se_he_quizcomments`\r\n WHERE `he_quizcomment_quiz_id`=?", $quiz_id); //delete quiz $query = he_database::placeholder("DELETE FROM `se_he_quiz` WHERE `quiz_id`=?", $quiz_id); he_database::query($query); }