<?php
include("connectSQL_Component.php");
if (isset($_GET["parent"])) {
    $parent = $_GET["parent"];

    $sql = "SELECT DISTINCT [revitVersion] FROM [BIMComponents].[dbo].[Component_Info2] WHERE [componentGroup] LIKE '%" . $parent . "%';";

    $fetchResult = sqlsrv_query($conn, $sql);
    $revitVersion = [];
    while ($row = sqlsrv_fetch_array($fetchResult)) {
        if ($row["revitVersion"] != null) {
            array_push($revitVersion, $row["revitVersion"]);
        }
    }

    echo json_encode($revitVersion);
}
