<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
if (isset($_POST['id'])) {
    $refid = $_POST['id'];

    // Recupera i sinonimi per il composto specifico
    $stmt = $conn->prepare("SELECT * FROM compundsvocabulary WHERE refid = ? AND preferred = 'N'");
    $stmt->bind_param('i', $refid);
    $stmt->execute();
    $result = $stmt->get_result();

    $data = [];
    while ($row = $result->fetch_assoc()) {
        $data[] = $row;
    }

    echo json_encode($data);
} else {
    echo json_encode(['success' => false, 'error' => 'Invalid input']);
}
