Database query results:
11 code ID 1
purchased 3 times
11 Legacy ID 2
purchased 10 times
on November 12th, ID 36
purchased once
on November 12th, ID 37
purchased once
SQL statement "$chartData"
countid
ID
FROM_UNIXTIMEadd_time"m /d"add_date
FROM user_order
GROUP BY id
? question question
my aim is to find out how many people "bought once" on that day throughout the month, and how many people bought it more than twice
is this sentence correct?
I wanted to throw it into Google"s chart, but I found that it didn"t seem right, and I couldn"t find the reason myself.
this is the format he wants.
data.addRows[
[1,37.8,80.8,41.8]
[2,30.9,69.5,32.4]
[3,25.4,57,25.7]
[4,11.7,18.8,10.5]
[5,11.9,17.6,10.4]
[6,8.8,13.6,7.7]
[7,7.6,12.3,9.6]
[8,12.3,29.2,10.6]
[9,16.9,42.9,14.8]
[10,12.8,30.9,11.6]
[11,5.3,7.9,4.7]
[12,6.6,8.4,5.2]
[13,4.8,6.3,3.6]
[14,1,4,6.2,3.4]
];
my PHP script
foreach$ chartData as $ key{
$ new = null;
$ old = null;
if$ key ["times"] == 1{
$ new + = 1;
$ old = 0;
} else {
$ new = 0;
$ old + = 1;
}
$ data [] = array
intsubstr$ key ["add_date"]3,2int$ newint$ old
;
}
the printed result is
[[11,0,1],[11,0,1],[12,1,0],[12,1,0]]
the first to print the date, the second is the number of people who only buy once, and the second is the number of people who buy more than twice.
it still feels strange. Do you have a train of thought?