I have an array of data containing monthly amounts from the current year and the previous year. The previous year always has all of its amounts, but when a current/future month in the current year is iterated it has a null value. Here is an example: This is my current code How can I roll previous month amounts into current
Tag: arrays
I can’t generate the correct Json file in PHP
it does not work properly please help me to get the correct json file? in particular when I inserted it in the site in php I got this array so the Json file creates it correctly this is the first array I generate via submit of my form. this array I add it to the end of the Json file,
how to remove a parent index array and change it to object in laravel
I have an array like below : What I want to do is simply to remote the parent 2021-08-08 items because I have the date inside the array already . Now, what I have tried so far is : But it gives me error of undefined index[0] . what I want this array to look like is like below :
I’m having a problem with codeigniter pagination
When I create pagination without category it works, but with the category, it works with wrong data. With category pagination, it should show the data of a single category. But unfortunately, it shows mixed category data. These things work fine on the Index function….. In my index controller… and my model for the index is … It works perfectly. But
HTML table in php foreach loop where the cell data is only populated if an element is equal to the table column head name
I have created my column headers in my table by using: $round is: This results in exactly what I want because $round won’t always result in the same number of columns. The data I want in the table row beneath those headers needs to be only those items that contain the column header’s name. Let’s say the column headers are:
Validating array only integer number in PHP
I want to validate an array so only integer number is allowed. I’ve tried some ways but still doesn’t get the result I want. I have array like this: First I’m writing a code like this: I got an error that said only string allowed for !preg_match function, this is because $total is an array. Next is I’m trying to
concatenate array values into string?
I have this array, is stored in a variable called $ data : and i want to add to another variable to send to an API but when i echo $body the result its like this: how can I add the string to have an output like this: thanks to all Answer If you’re using XML, it’s better to learn
Add data from second 2d array to first 2d array based on related id columns
I have two arrays $a and $b AND I am trying to create another array with mapping with id(array $a), a_id (array $b), where my output will looks like: I have tried by array map But this result is not my desire result. How can I map my 1st array with 2nd array related by $a[‘id’] = $b[‘a_id’]? Answer This
Get values from array inside another array for later storing them in db
I’m sending 2 datas with same name at the front side like this And then I’m trying to store that value in my database through my model methods in codeigniter 3 This is what I was doing before with just 1 data But now that im dealing with more input data i dont know how to handle it im storing
ErrorException Array to string conversion in Laravel form submission with repeater fields
In my Laravel application, I have the following form to submit data: This is my create.blade.php And my controller looks like this: Now the problem is, whenever I tried to submit the data, it gives me an error saying ErrorException Array to string conversion test_type and test_result fields are repeaters. Due to that, I’ve used those field names as test_type[]