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 Value Of Table Field
redirecting a long URL to https
How to embed this php code in html?
Uncaught Error: Call to undefined function curl_init()
Multi level login by address
SELECT * FROM table WHERE `id` in … and where sum() less
Laravel: Undefined method fake on Laravel storage facades for file upload testing
Very Complex SQL Data Result Merge via PHP (Multi Dimentional Arrays)
codeigniter Insert_batch not working
How do I fix this invalid JSON that wasn't escaped? (in PHP)
PHP: how to adding date with number of month from database? [duplicate]
Illegal string offset 'class' in ( php 7.1.1 ) [duplicate]
How to Create a shortcut automatically on mobile to a website
Automatization of a conditional function through the use of an array to test postdata variables
get form values from one php “echo” to the other
Prepare data for inserting ST_GeomFromText in database (Codeigniter + MySql)

Categories

HOME
hpoo
google-chrome
typelite
verification
key
embedded-resource
websocket
bing-search
google-search-console
supercollider
onvif
csrf
documentum
createjs
ex
pushdown-automaton
vertica
robolectric
android-custom-view
workday
pymongo
fluent-migrator
eclipse-emf
web-config-transform
history.js
basex
spring-annotations
jsonresult
nic
steam-web-api
john-the-ripper
appcode
quickcheck
numerics
jade4j
llvm-ir
best-buy-api
imgur
rightnow-crm
sonarqube5.2
aws-kinesis-firehose
nothing
photoswipe
sonicmq
openstack-glance
wikimapia
rcharts
front-camera
prefetch
livereload
dcount
fuzzer
p6spy
raw-sockets
piping
maximize
mnesia
onepage-checkout
cortana
diawi
android-mapview
supersocket.net
fantom
modern.ie
dynamics-ax-2012-r2
subfolder
scala-swing
mod-auth-openidc
fasterxml
n-tier-architecture
configurable-product
quantify
visual-c++-2012
libgcc
box2dweb
siena
treeline
sql-function
ctp
infinite
revmob
reentrancy
handshake
workflow-manager-1.x
platform-independent
uploading
differentiation
space-partitioning
nosetests
kext
explicit
xap
tso
datagridcolumn

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