<?php
header('Access-Control-Allow-Origin: *');
header("Content-type: application/json; charset=utf-8");

// error_reporting(0);

include '../../utils/database.php';
include '../../utils/helper.php';

$type = $_GET["type"];

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname_process);
// Check connection
mysqli_set_charset($conn, "utf8");
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$questions = array(); 

$query = "SELECT * FROM questionsV2 WHERE `type`='$type' and `active`=1";
$result = $conn->query($query);
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        array_push($questions , $row["qid"]);
    }
}

print_r($questions);