I have an array of database from a Wordpress page:
dev-user-20190424.php
<?php
$wb_users = array(
array(
"Username" => "Azmina",
"Level" => "form-5",
"School" => "KOLEJ D PATINGGI ABANG HJ ABDILLAH, SARAWAK",
"SchoolID" => 4522,
),
array(
"Username" => "Gudako",
"Level" => "form-5",
"School" => "KOLEJ D PATINGGI ABANG HJ ABDILLAH, SARAWAK",
"SchoolID" => 4522,
),
array(
"Username" => "Takatosaijo29",
"Level" => "form-5",
"School" => "SEKOLAH MENENGAH KEBANGSAAN BAHANG, SABAH",
"SchoolID" => 4210,
),
array(
"Username" => "Obon",
"Level" => "form-5",
"School" => "SEKOLAH MENENGAH KEBANGSAAN BAHANG, SABAH",
"SchoolID" => 4210,
),
array(
"Username" => "Rayana12",
"Level" => "form-5",
"School" => "SEKOLAH MENENGAH KEBANGSAAN BAHANG, SABAH",
"SchoolID" => 4210,
),
array(
"Username" => "kaiyuanbeh",
"Level" => "form-5",
"School" => "SEKOLAH MENENGAH KEBANGSAAN PERMATANG RAWA, PULAU PINANG",
"SchoolID" => 4250,
),
array(
"Username" => "Divyabharthi",
"Level" => "form-5",
"School" => "SEKOLAH MENENGAH KEBANGSAAN PETALING, WP KL",
"SchoolID" => 4244,
),
array(
"Username" => "blackchocolatecake",
"Level" => "form-4",
"School" => "SEKOLAH MENENGAH KEBANGSAAN POI LAM, PERAK",
"SchoolID" => 4375,
),
);
So what I am trying to achieve is to display the total number of users on another WordPress page by looping the array $wb-users and if SchoolID is matched current user school id variable, then count it. Then the total number of users will be displayed on the page.