Tengo una serie de tablas las cuales tienen información para rellenar mi highchat. El problema es que no he logrado generar el código para traer de la base de datos esa información:
$command = $connection->createCommand('SELECT idClient,name,country,image
FROM client');
$posts = $command->queryAll();
$nameClient = array_column($posts, 'name');
//print_r($nameClient);
foreach ($nameClient as $key => $value) {
$arrayName[] = $nameClient[$key];
}
// print_r($arrayName);
$connection->open();
$count = $connection->createCommand('SELECT count(name),name FROM client');
$numt = $count->queryOne();
# code...
//$numClients['num'] = 1;
foreach ($posts as $key => $value) {
# code...
$getIdIssues= $connection->createCommand('SELECT name,idissuetype as
idissues FROM issuetype');
$idIssues = $getIdIssues->queryAll();
//$nameIssue = $queryGetName->queryOne();
foreach ($idIssues as $key1 => $value1) {
# code...
//print_r($dataLista);
$queryDataClientes= $connection->createCommand("SELECT DISTINCT
iss.name AS '0', COUNT(*) AS '1'
FROM
issues AS isu,
project AS pr,
client AS cl,
issuetype AS iss
WHERE
isu.project_idproject = pr.idproject
AND cl.idclient = pr.client_idclient
AND cl.idclient = ".$value['idClient']."
AND iss.idissuetype = isu.issuetype_idissuetype
AND iss.idissuetype = ".$value1['idissues']."
GROUP BY
issuetype_idissuetype
HAVING
COUNT(*) >= 0
ORDER BY issuetype_idissuetype;");
$dataClientesQuery = $queryDataClientes->queryOne();
echo "<pre>";
$dataClientesQuery['1'] = (empty($dataClientesQuery['1'])) ? 0 :
(int)$dataClientesQuery['1'] ;
$dataLista[$key]['data'][]= (int)$dataClientesQuery['1'] ;
}
}
print_r($dataLista);
Así queda:
Array
(
[0] => Array
(
[data] => Array
(
[0] => 1
[1] => 0
[2] => 0
)
)
[1] => Array
(
[data] => Array
(
[0] => 2
[1] => 3
[2] => 0
)
)
[2] => Array
(
[data] => Array
(
[0] => 1
[1] => 0
[2] => 0
)
)
[3] => Array
(
[data] => Array
(
[0] => 1
[1] => 0
[2] => 0
)
)
)
Así tiene que quedar tomando en cuenta que la cantidad tienen que ordenarse por issues:
Array
(
[0] => Array
(
[name] => Historias
[data] => Array
(
[0] => 10
[1] => 7
[2] => 3
[3] => 4
[4] => 7
)
)
[1] => Array
(
[name] => Defectos
[data] => Array
(
[0] => 5
[1] => 7
[2] => 3
[3] => 4
[4] => 7
)
)
)
Para mas información por favor indicar.