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

Permission Issues
Show data according to date in different tables
Codeigniter: Auto logged in the newly registered user on the site and redirect to profile page
PDO: Invalid parameter number: parameter was not defined
Httptest.php error in logs
array in php function undefined
How to save php html page as pdf
PHP mysql display query in 4 columns
Can I get data from a table based on multiple other tables?
php prepared statement won't update or insert whole data
FOSUserBundle - Group assignment in UserType form
display array foreach record
json_decode() php manage special characters TM symbol
three different table in one views laravel 5.2
Fatal Error with PhP on submit
I can't get both my header and footer menus to display properly in my wordpress theme

Categories

HOME
oracle
artificial-intelligence
functional-programming
loopbackjs
dafny
magento-2.0
consul
clone
firebase-database
sympy
colors
fbloginview
phpstorm-2017.1
cuba-platform
trace32
squid
async-await
android-5.1.1-lollipop
web-analytics
el
stackexchange.redis
device
tortoisemerge
tracing
crud
acrobat
react-bootstrap-table
tsung
audit
monitor
xenapp
windowsiot
publishing
memory-fences
opnet
private-key
adminer
xerces-c
assertions
pdfnet
xvfb
ms-solver-foundation
swfupload
jacoco-maven-plugin
ejml
word-cloud
elasticsearch-aggregation
httphandler
dbcc
git-tfs
moinmoin
aurelia-fetch-client
winmerge
nslayoutconstraint
deedle
glassfish-4.1
lvalue
case-when
business-rules
pbx
gawk
boost-compute
yargs
livereload
bilinear-interpolation
nsrunloop
eclemma
gnucash
highlighting
accessibilityservice
webgrind
calcite
pythonxy
extend
mutators
fasterxml
qt5.4
ecos
nidaqmx
webmethod
profiles
compiler-flags
ember-table
pacman
insertion
jbox2d
oembed
itunes-sdk
handshake
towers-of-hanoi
clrprofiler
yuidoc
fbml
botnet
nsrangeexception
jmenu
nsconnection
3des
android-2.1-eclair
explicit
odac
sscli
raw-data
google-translator-toolkit
wmd-editor
comment-conventions

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App