<?php
require_once 'connection.php';
$select_stmt=$db->prepare('SELECT MAX(result) AS Name, COUNT(result) AS Count FROM `results` GROUP BY (result)');
$select_stmt->setFetchMode(PDO::FETCH_ASSOC);
$select_stmt->execute();
while($record = $select_stmt->fetch()) {
$transfers[] = $record["Name"];
$counts[] = $record["Count"];
}
$mystring = implode("','", $transfers);
$transfers_modify = "'$mystring'";
$select_stmt=$db->prepare('SELECT j.result_color,pas_project FROM structure_test t JOIN JSON_TABLE(t.structure, "$.exodus[*]" COLUMNS(result_combination varchar(20) PATH "$.result_combination", result_color varchar(20) PATH "$.result_color", result VARCHAR(20) PATH "$.result", result_description VARCHAR(255) PATH "$.result_description")) j WHERE j.result IN ('.$transfers_modify.') AND named_project=:pname');
$select_stmt->execute(array(':pname'=>$pn));
while($record = $select_stmt->fetch()){
if($select_stmt->rowCount() > 0){
if(password_verify($pp, $record["pas_project"]))
{
$colors[] = $record["result_color"];
}
}
}
$response = array("transfers"=>$transfers,"counts"=>$counts,"colors"=>$colors);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
?>
SELECT j.result_color
FROM structure_test t
JOIN JSON_TABLE(t.structure,
'$.exodus[*]'
COLUMNS(result_combination varchar(20) PATH '$.result_combination',
result_color varchar(20) PATH '$.result_color',
result VARCHAR(20) PATH '$.result',
result_description VARCHAR(255) PATH '$.result_description')) j
WHERE j.result IN ('IT разработка','Менджмент');