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

Where is php.ini file of php_fpm?
laravel migration creates different schema
How to create facebook page with PHP or CURL?
How to convert INR to USD before passing to paypal in opencart
How to know the Dynamodb updateItem response status in AWS SDK for PHP
How can I test why sendmail / php isn't working?
Retrieve table data from another webpage using PHP
Extremely confusing (And infuriating) PHP/HTML problems
What is the facebook.com/sharer.php ios/android url schema for mobile websites?
zf2 oauth2 catching extra params
pagination limit images per page
get rows by specific TMZ
PHP : Associative array indexing issue
symfony error in production : Undefined variable matches appDevUrlMatcher.php
assign 2 values to an array item
Joomla Profile Custom Field Placement

Categories

HOME
office365
nam
user-interface
typelite
shinyapps
postgresql-9.4
scroll
theano
moodle-api
greasemonkey
u-boot
wagtail
parsley.js
sap-fiori
orc
jquery-select2-4
web-deployment
checkout
uislider
perfino
restier
vuforia
environment
raima
unrar
onchange
oracleforms
social-networking
openbr
shapeless
express-session
transform
landscape
xvfb
aurelia-cli
cheat-engine
python-jira
get-event-store
hdiv
raytracing
access-denied
julius-speech
kitura
linq-to-excel
realstudio
swift2.3
sonicmq
ilrepack
jgrapht
sharpdx
spring.net
algebra
predicates
hmmlearn
cognos-tm1
msg
nunit-console
odp.net-managed
urbit
gravatar
jsr363
pack
bjam
pythonxy
actionpack
console.log
shoes
findersync
mod-auth-openidc
mojo
symja
window-resize
squeezebox
redpitaya
pre
eclim
non-ascii-characters
virtual-channel
sly-scroller
icenium
pageheap
kobold2d
netstream
acpi
glassfish-esb
nosetests
kext
hungarian-notation
ios-4.2
uninstaller
resharper-5.0
iphone-sdk-3.1.3
twitter-feed
synthesizer

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