skip to Main Content

php loop through array and output date and counter

So I have this code: $avaDates = [['date_starts'=>'2024-03-01'],['date_starts'=>'2024-03-09'],['date_starts'=>'2024-04-05'],['date_starts'=>'2024-04-09'],['date_starts'=>'2024-04-15'],['date_starts'=>'2024-05-03']]; $sum = 0; $months = ''; foreach($avaDates as $date){ $monthCheck = substr($date['date_starts'], 0, -3); if($months !== $monthCheck){ $months = $monthCheck; $dateFormat = date("F-Y", strtotime($months)); echo strtolower($dateFormat).' '.$sum."n"; $sum = 0; } $sum…

VIEW QUESTION

Attempt to read property "id" on bool in Laravel 8

I got this data from an external API call. $countries = @file_get_contents('https://external../api/countries'); $countriesArray = json_decode($countries, true); print_r($countriesArray); //dd($countriesArray); Array ( [success] => 1 [message] => countries [data] => Array ( [0] => Array ( [id] => 1 [name] => Afghanistan…

VIEW QUESTION

How can I use a variable outside while loop in java mysql

String xxx = "Select Totalpay from payments2 where committee_member = '"+memberName+"'"; pst = conn.prepareStatement(xxx); rs = pst.executeQuery(); while(rs.next()) { String totalPayment = rs.getString("TotalPay"); } table.addCell(cell); //String ttlpy = create(); table.addCell(totalPayment); I get the error at table.addCell(totalPayment): variable totalPayment may not…

VIEW QUESTION
Back To Top
Search