Hello I have a problem with my SQL code and I don't know what's the cause. Below is my code:
//Sanitize the POST values
    $appdate = clean($con, $_POST['appdate']);
    $apptime = clean($con, $_POST['apptime']);
    $topic = clean($con, $_POST['topic']);
    $evaluation = clean($con, $_POST['evaluation']);
    $counselor = clean($con, $_POST['counselor']);
    $desc = clean($con, $_POST['desc']);
    $sql="INSERT INTO appointment VALUES(NULL, '$memid', '$counselor', '$appdate', '$apptime', '$topic', '$evaluation', '$desc', 'Pending')";
    $test=mysqli_query($con, $sql);
    //Check whether the query was successful or not
    if($test) {
        header("location: main.php?page=appointments");
        exit();
    } else {
        echo "Query failed.";
        exit();
    }
The problem is, I only can insert 1 data only to the table. The next data can't be inserted inside the table, it will show "query failed". It is confusing to me. Can someone helps me.
p/s: sorry for bad grammar/english
 
    