<?php
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);

require('../../../core/controller/Database_admin.php');
$db = Database::connectPDO();

$line_acc = $_POST['line_acc'];

$statement_1 = $db->query("SELECT * FROM specific_action WHERE name_strategic = '$line_acc' ORDER BY name_specific_action");
$res = $statement_1->fetchAll();

$html = "";

if (count($res) > 1) {
	$html = "<option value=''>- SELECCIONE -</option>";
}

if (isset($res)) {
	foreach ($res as $row) {
		$html .= "<option data-formation='" . $row['has_formation'] . "' data-description='" . $row['activity_description'] . "' value='" . $row['name_specific_action'] . "'>" . $row['name_specific_action'] . "</option>";
	}
	$array = array(
		"html"  => $html,
		"total" => count($res),
	);
}
echo json_encode($array, JSON_FORCE_OBJECT);
