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

Get extension key inside of post processor
Remove image from folder after deleting in codeigniter
The Csrf token could not be verified?
Replace all the <a> tags in string except with one specific ID using preg_replace
Stripe/Laravel single charge before registration
Query database for most current message per receiver_id [duplicate]
how can i access an array in my controller file to view file in codeigniter
Yii2 HTML5 Server-Sent Events not real time on server
PHP REQUEST URI not possible on Anchor pages
jqGrid dataInit doesn't trigger
Wordpress importing database - CREATE command denied to user
php preg_split ignore comma in specific string
Fetch all rows grouped by a specific column using PDO and selecting all columns
Building a multidimensional Array with another Array in PHP
session becomes empty when accessed in another function
same base code for multiple domains/websites

Categories

HOME
opengl
qc
couchdb
activex
dafny
braintree
visual-studio-2010
nsis
cryptography
sympy
mutation-testing
scrape
getopenfilename
android-externalstorage
responsivevoice
sonata
pywinauto
google-tasks-api
reselect
pinterest
pygobject
susy-sass
home
raml
bluemix-mobile-services
node-webkit
azure-machine-learning
android-permissions
quartz.net
dragula
raima
hdmi
xdebug
sap-lumira
openbravo
ruby-daemons
python-imageio
gravity-forms-plugin
adapter
openbr
vcenter
steam-web-api
delayed-job
payeezy
autoencoder
grails-2.5
textmate2
forms-authentication
variable-variables
strapi
distributed-caching
yoast
xcglogger
extjs4.1
punctuation
watir-webdriver
webvtt
connect-direct
email-forwarding
.when
degrees
finder
email-injection
pjax
bigdecimal
dojo-build
gnucash
textblock
gulp-uglify
preferenceactivity
android-expansion-files
ioctl
m4
ajax4jsf
outlook.com
opencyc
http.client
blank-line
canopy
ipod
console.log
mgwt
nsmutabledata
fiware-bosun
adhoc-polymorphism
nesper
producer
visual-studio-6
nachos
prism.js
air-native-extension
jack
assetic
smips
jquery-transit
codahale-metrics
virtual-channel
xs
days
dojo-1.9
smartfox
tridion-2011
nsmutablestring
trialware
wcf-callbacks
quartz-core
qt-mobility
azure-acs
eaccelerator
android-2.1-eclair
j2mepolish
yahoo-maps
prism-2
acceleration
code-camp
community-server
parentid

Resources

Encrypt Message