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

Using ajax how to get data from the database in PHP?
How to check the exception thrown correctly by PHPUnit?
How to encrypt the $_GET data in php?
jquery mobile lost css with ajax post
if div with id has certain text remove other div
PHP inside PHP Syntax and Logic
How to send sms using php script from ftp server
Regex phone validation
MySql, PHP display Picture on HTml
Updating a page element in a php script
jQuery: Ajax before submitting form
subdomain to url redirect with mod_rewrite and htaccess?
associate cakephp model to non-cakephp database table
Adding Content-type to Pear Mail
Form Evaluation With PHP
Loading an array of arrays from mysql

Categories

HOME
weblogic12c
cucumber
openxml
gallery
share
facebook-android-sdk
haxe
native-base
angular2-template
mutation-testing
wine
gtk
siesta
fireloop
cqrs
responsivevoice
grocery-crud
live-streaming
wsf
sqlplus
dashdb
kamailio
batch-rename
intel
candlestick-chart
pyopencl
dragula
unordered-multimap
fstar
list-comprehension
bonita
rspec-rails
android-canvas
nanogallery
widestring
jqgrid-asp.net
transparency
libreoffice-writer
ol3-google-maps
brightscript
iptv
case-when
prefetch
scheduledexecutorservice
nsrunloop
traversable
jtag
perforce-integrate
qpixmap
static-methods
ioctl
ajax4jsf
perceptron
juniper-network-connect
mousehover
lowercase
dnx50
search-form
org-babel
ipod
incron
mojo
dc
utf8-decode
xml-signature
box2dweb
coding-efficiency
distributed-r
screwturn
redpitaya
sly-scroller
semicolon
background-thread
cyrillic
audiotoolbox
clrprofiler
thejit
platform-independent
fitch-proofs
nsfont
drawimage
office-automation
kext
printqueue
aptitude
jdownloader
resharper-5.0
browser-based
yahoo-maps
firephp
ntruencrypt

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