I am new to MongoDB and PHP and I am trying to make an API. The current problem I have is that I am not able to add an array into an object that is inside an array (of objects). I have tried a lot, but all failed. This is the document I have so far: I would like to
Tag: arrays
find repeating unknown value from different keys of subarrays in PHP
I have an Array like this. this is a connection log of some devices to Internet. source IP: [src_ip] and destination IP: [dst_ip] based on Sending or Receiving connection states change their position. we don’t know current network state (sending/receiving) also we don’t know current IP of device. IP of device is fixed but sometimes it placed on [src_ip] sometimes
php how to put foreach loop value in array
i want to put foreach in values in array to assign value as loop in array. how to do that? i try put foreach inside array but looks like its wrong. my array code: if i print i will get this value Array ( [0] => Array ( [item_varid] => 109 [item_id] => 146 [item_basename] => aaa [item_baselink] => products.php?id=146
Search data from array of object inside foreach loop
I have 3 array. The first one is array employee, second is array dateRange(Y-m-d), and the third is array attendance The array is like this: Array Employee Array dateRange Array Attendance (both in & out) What I want to do is to get attendance data from array attendance where employee_id is the same as employee_id in array employee. What I’ve
Dont print empty json arrays in php
Im programming a website where I can query server details from a game server. The problem is, that Ark sometimes prints empty playernames. That happens because there connecting at this moment or because they’re bots. I dont want to show them on my website. The problem is, that i don’t know how to exclude them. Maybe somebody can help me.
Array to tree structure with no Id just string as keys (is this possible?)
I’ve been failing (my whole day) in getting this structure formatted as a tree to present in this format, see picture attached. as this has not parent and child the names of the key values strings like pattern_type_name act like parents and pattern_name are the child and under pattern_name are the marker_description to present the structure. structure to display any
Invalid JSON path expression. The error is around character position
I insert json data to mySql database like this: Now, I try to update social-enable value using JSON_REPLACED method like this: In action I see this error: How do can I fix this problem? Answer JSON Path Syntax … Names of keys must be double-quoted strings or valid ECMAScript identifiers (see Identifier Names and Identifiers, in the ECMAScript Language Specification).
How to create multidimensional array unlimited depth array with parent and child came from single table
Im trying to create multi-dimesional array with unlimited depth. I select the data from the database and check it if the field ‘isArray’ is true, meaning this column is a parent then I tried to make a loop to make it look for its child ‘parent_id’ => $row->id. I’m expecting output like this. And the data I get from the
In PHP, for a specific key in an associative array, find identical keys and combine values into a single string variable
I have found many references for similar questions on SO but nothing close to what I’m trying to do. I have this array output: I would like to now use ‘kp_uid’ to locate all common values and then combine the ‘full_name’ values for each key into a string (with comma separation). Desired outcome from above example will be: I have
check index of columns in key of an array and remove columns with value 0
I have a php code that takes the matched rows of a csv file and puts them in an array. my csv file looks like this: and my php code is so var_dump($sortiment_array); will give me the following What I would like to do is to have the 0 columns taken out from the array and so therefore I need