PHP – Inserting multiple questions in the database, but only the first question is inserted

I’m working on prepared statements in PHP for the questions to fetch them in the front-end (I’m working with Reactjs). The issue is I put all 13 questions, together with their types in an array, prepared for insertion with foreach loop, only to see that the first question made it to the database, but this is not what I’m achieving, as the goal is to push all questions to the database and their types. The code and the result can be found down below.

$questions = array(
"How big is the company?" => "multiple-choice",
"Would you like to make a short description about the company/you?" =>  "input_field",
"Which is your target goal for the website solution?" =>  "multiple-choice", 
"How much is your annual budget?" => "input_field", 
"Do you have a website?" =>  "yes/no",
"What kind of website would you like/is your current website?" =>  "multiple-choice",
"How many pages do you need for the website?" => "multiple-choice",
"What works well on the website, and what not and would like to get fixed?" =>  
"input_field", 
"Would you like to help you with integrating your web solution in the market? (e.g. 
SEO)" =>  "yes/no", 
"Would you like to help you with integrating your web solution with other software?" =>  
 "yes/no",
"Is your website responsive? If not, we'll help you with offering a responsive design to 
the website" =>  "yes/no",
"What kind of additional services would you like to have implemented to the website?" =>  
"multiple-choice",
"Would you like to have the website available in english as well?" =>  "yes/no"
);



 try {

    foreach ($questions as $text => $type) {

        $db = _db();

        $q = $db->prepare("INSERT INTO questions(question_id, text, question_type) VALUES(:question_id, :text, :question_type)");
        $q->bindValue(":question_id", null);
        $q->bindValue(":text", $text);
        $q->bindValue(":question_type", $type);
        $q->execute();

        $id = $db->lastInsertId();
        $row = $q->fetchAll();

        if($row > 0) {
            header("Content-type: application/json");
            http_response_code(200);
            echo "Success";
            exit();
            
        } else {
            header("Content-type: application/json");
            http_response_code(200);
            echo "Failed to insert";
            exit();
        }

    }

The result each time I was trying to insert all the values

I’m working with PHP PDO, and the only solution might be the for loop, but I’m getting the “expected type ‘iterable|object’. Found ‘string’.” error. Thanks in advance.