php


Count occurrences across multiple arrays in PHP


I have multiple arrays returned in PHP that are generated from this query...
"SELECT * FROM `infringements` where (submittime >= '$datefromp' and submittime <= '$datetop') and stkey = '$stkey' ORDER BY submittime DESC";
and the output look like...
Array (
[ID] => 32
[STKEY] => 2087
[FIRST_NAME] => John
[SURNAME] => Smith
[GENDER] => F
[SCHOOL_YEAR] => 08
[ROLL_GROUP] => MILANG
[HOUSE] => UN
[hat] => 1
[jewellery] =>
[socks] =>
[makeup] =>
[hair] => 1
[shoes] =>
[icuniform] =>
[icpeuniform] =>
[INFRINGEMENT] =>
[USER] => vsmall
[SUBMITTIME] => 2017-05-15 14:26:42
)
There can be multiple arrays returned from the query and the users can submit multiple entries (via a form) each day. I would like to count the number of times that 'hat'=1 and/or 'socks'=1 etc per day. If they are empty then they can be skipped. What is the best way to do this?
I would like to display these counts back to the user.
Example:
15-05-17 - Hat x2
- Hair x1
16-6-17 - Hat x1
- Socks x1

Related Links

Data table with in line create
Display images from WordPress post
Zend framework 1 - Can't get through login page
A2Billing subscription change
Mailwatch Quarantine Not Showing Contents
Too Many Redirect Error with htaccess for site
Apache 2 + PHP - Issue with .htaccess permissions
How to output database data as separate integers in order to use them for an if-else condition?
Magento - Get Configurable Product Available Sizes
Eloquent - Eager Loading Relationship
Cannot verify a saved a temporary password in php used in android
php get function argument length
All the data are not retrieved from a field in mysql
Open socket and send packets in PHP through SOCKS5
How to move blob from one table to another? [duplicate]
One to one combine array values

Categories

HOME
qt
amazon-web-services
webview
list
cucumber
facebook-messenger
livecode
barcode-scanner
softlayer
postgresql-9.4
enums
ews
malware
jpa-criteria
port
match
nexus3
jquery-file-upload
bundler
dhcp
trace32
susy-sass
spring-shell
azure-machine-learning
altium-designer
batch-rename
mod-wsgi
crud
annotation-processing
miniprofiler
ibm-connections
premake
windows2012
publishing
xcrun
epplus
spring-rabbitmq
db2-luw
jfxtras
wdk
textmate2
aurelia-cli
mars-simulator
export-to-pdf
grunt-contrib-watch
julius-speech
gcal
sonarqube5.2
tinyioc
icecast
nusoap
openstack-glance
redisson
android-sharing
htmlspecialchars
http-basic-authentication
ptvs
glimpse
rustdoc
gapi
portal
rational-performance-test
deviare
tablespace
fragmentstatepageradapter
groovyfx
bbc-micro
rails-engines
psd
trust
ioexception
lovefield
phpquery
python-cffi
godeps
stack-smash
arbre
mousehover
fanotify
screen-orientation
auto-generate
postal-code
modern.ie
domino-designer-eclipse
org-babel
mod-auth-openidc
fat32
dos2unix
cout
android-2.3-gingerbread
reference-counting
rails-api
map
code39
smips
rautomation
flv
notin
days
user-forums
trialware
uipangesturerecognizer
quartz-core
multidrop-bus
net-use
getopts
qt-mobility
mygeneration
resharper-5.0
getimagesize
eai
activex-exe
regioninfo

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App