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

Amazon Place order API
How to display short permalinks in WordPress?
why is PHP_EOL adding a strange character?
How do I use the same object for multiple hooks in CodeIgniter?
Slim error handling
2 Errors in One Code warning: mysql_fetch_assoc() expects warning:cannot modify header [duplicate]
How to get the UK timezone in PHP and detect midnight?
upload picture when register forum
Severity Notice: Code Igniter
PHP header not working after uploading it to the server
Add a table alias retrieving relation using the with method Eloquent
Symfony2 FormType entity field type
Yii 2 - radioList Template
XPath expression to set empty index
Cannot replace a same emoticon once more in a post
Authorize.net - request rejected by fdc omaha -invalid transaction type

Categories

HOME
opengl
mod-rewrite
dotnetnuke
d3.js
whmcs
jersey-2.0
heuristics
twitter-oauth
bootstrap-switch
stimulsoft
webstore
synthesis
bnf
web-deployment
checkout
coroutine
clr
yii2-basic-app
maven-surefire-plugin
firemonkey-style
pubxml
crud
android-cardview
laravel-4.2
microprocessors
javax.persistence
jsonresult
es6-modules
rspec-rails
kendo-listview
bootstrap-sass
char-pointer
textmate2
formsauthenticationticket
cargo
gitolite
stat
utf
optionaldataexception
vesta
roracle
sharpdx
punctuation
android-mediarecorder
popen
dymola
hmmlearn
google-shopping-api
maatwebsite-excel
mifos
controllers
tablespace
coovachilli
fragmentstatepageradapter
codecharge
management-studio-express
deeplink
astropy
fanotify
extend
erlog
prism-4
nssortdescriptor
directorysearcher
visual-c++-2012
aho-corasick
accessory
forio-contour
.htpasswd
reference-counting
meteorite
colon
apache-shindig
mp4parser
apportable
days
spark-view-engine
live-wallpaper
image-formats
background-repeat
mvcrecaptcha
upshot
simile
mygeneration
android-2.1-eclair
ios-4.2

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile