Return a php query array

Asked

Viewed 42 times

0

Good morning, I’m starting with php and I’m having the following doubt I am populating a graph that is of the MONTHLY requests, in js

The way to spare him is as follows:

                       ...
                       pointHighlightFill: "#fff",
                       pointHighlightStroke: "rgba(220,220,220,1)",
                       data: [12,11,10,9,8,7,8,8,5,5,3,4] //AQUI POPULA
               },

I have the following appointment at the bank:

select COUNT(SolID) total from Solicitacao where 
UsuIDGrupoRespConclusao = 2655
AND DATEPART(yyyy, SolData) = DATEPART(yyyy, DATEADD(m, 0, getdate()))
group by MONTH(soldata)

This consultation consults me ALL ANNUAL requests, will return me 11 lines, the first for the month of January, second February and so on.

How do my PHP query in the database and store that return (only one query) within 12 variables, and so I fill this graph?

  • 1

    Puts code in text that is easier to view

  • Can you post the code? I saw that you have an image but not everyone can see. Via code it is easier to analyze.

  • All right, I switched

1 answer

1

An easy way to do it is to turn the 11-line array into a string with the data separated by comma, then you just put the string in the json date, in php you do so:

$suaArray = array('12','11','10','9','8','7','8','8','5','5','3','4');
$suaString = implode(",", $suaArray);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.