1
I have a query ready (I didn’t do it) that every month I change the values of the months, copy and paste in phpMyAdmin (in the SQL tab) to run. She presents me with a very beautiful and structured answer in columns. But how do I make the same answer directly in PHP?
The query is this:
SET @date_ini = '2019-02-20 00:00:00';
SET @date_end = '2019-03-19 23:59:59';
SELECT DISTINCT(`dstchannel`) as Canal,
count(1) as qtde,
SUM(IF(billsec< 30, 30, ((`billsec` DIV 6) * 6) + (IF(`billsec` % 6 > 0,6,0)))) as Segundos ,
sum(IF(billsec > 30,1,0)) as qtde_maior30,
SUM(IF(billsec > 30, ((`billsec` DIV 6) * 6) + (IF(`billsec` % 6 > 0,6,0)),0)) as Segundos_maior30
FROM astcdr.cdr WHERE `dstchannel` LIKE 'Khomp/B%' AND `calldate` BETWEEN @date_ini AND @date_end and billsec > 3 GROUP BY Canal ;
And the answer phpMyAdmin shows is this:
I just don’t know the name of the fields over there where $Row['given']!
– Gustavo
is the same name as on the table
– Marccus Zavadzki