如何删除mysql中的插入过程

时间:2018-09-05 12:29:00

标签: php mysqli

我是mysql和php的新手,我是自学成才的,所以没有人可以帮助我。每当插入时,我如何在我的php文件中删除此插入过程,因为它插入得很好,但我想删除该过程。 我的PHP代码在下面

<?php 
 if(isset($_POST['insert_quiz'])) {
     var_dump($_POST);
     $quiz_add_id = $_SESSION['quiz_id'];
     $count = $_SESSION['quiz_no'];
     if (
       !empty($_POST['question']) && !empty($_POST['optionA']) && !empty($_POST['optionB']) && !empty($_POST['optionC']) && !empty($_POST['optionD']) && count($_POST['op1']) === count($_POST['question'])) 
     {
        $question_array = $_POST['question'];
        $optionA_array = $_POST['optionA'];
        $optionB_array = $_POST['optionB'];
        $optionC_array = $_POST['optionC'];
        $optionD_array = $_POST['optionD'];
        $op1_array = $_POST['op1'];
        for ($i = 0; $i < $count; $i++) {
            $question = $question_array[$i];
            $op1 = $op1_array[$i];
            $optionA = mysqli_real_escape_string($connection, $optionA_array[$i]);
            $optionB = mysqli_real_escape_string($connection, $optionB_array[$i]);
            $optionC = mysqli_real_escape_string($connection, $optionC_array[$i]);
            $optionD = mysqli_real_escape_string($connection, $optionD_array[$i]);

            $query = "INSERT INTO quizzes (quiz_add_id, quiz_question, quiz_option_A, quiz_option_B, quiz_option_C, quiz_option_D, quiz_option_correct)";

            $query .= "VALUES ('{$quiz_add_id}', '{$question}', '{$optionA}','{$optionB}','{$optionC}','{$optionD}', '{$op1}')";

            $create_quiz_query = mysqli_query($connection,$query);
        } 
        if(!$create_quiz_query ) {
              die('QUERY FAILED' . mysqli_error($connection));
        }
//     
     }
 }
?>

这就是我插入时不想看到的东西

enter image description here

1 个答案:

答案 0 :(得分:1)

删除以下代码

var_dump($_POST);