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

Comparing two floats [duplicate]
Http server error on windows azure platform
assort merge two assorted arrays
How to use fopen() in PHP to write passwords to txt
don´t redirect to a view and I want to show the current users' list
I have uploaded wordpress and then getting 500 - Internal server error
Repository Entity not found in symfony2
Decode a Json string
New here and to PHP. Parse error [closed]
Passing as a param
Why won't my $_SESSION variable change for each field [duplicate]
Pagination only returning first page values
How to multiply with sum in Laravel
Extracting data from array in Yii 2
Prevent Back Login After Logout by hitting the Back button on Browser in L5?
Having trouble with testing code using PHPunit

Categories

HOME
jboss
workflow
softlayer
devexpress
hid
apk
biztalk-2010
azure-mobile-services
swarm
documentum
responsivevoice
uima
l20n
boomi
cpu-usage
bazaar
jitsi
pe
conda
rxjs5
quantitative-finance
exchange-server-2010
sipp
clipboard
python-imageio
jsonresult
substance
dotcms
nsmutablearray
autoencoder
wdk
keyboard-layout
assertions
cordys-opentext
strapi
1wire
haar-classifier
type-inference
realstudio
windows-media-player
ol3-google-maps
password-hash
sonicmq
sequence-diagram
mura
google-shopping-api
petsc
e
fuzzer
nsrunloop
tsqlt
qpixmap
polymerfire
gulp-uglify
univocity
certificate-authority
enunciate
cryptojs
miniconda
dsa
srv-record
auto-generate
extend
scala-macros
rfc5545
operands
jquery-mobile-flipswitch
aho-corasick
zend-search-lucene
miglayout
pbkdf2
microformats
chartfx
days
smartfox
word-frequency
liveconnect
will-paginate
snackjs
radscheduler
motif

Resources

Encrypt Message