Skip to content
Advertisement

Tag: arrays

Converting a database result of 3 columns to associative array

I have a MySQL query that returns the following result: I need to loop through the result and create a new associative array where the key is the ApptTime and the value is the combination of ApptType and Count like so: I’ve tried looping through the mysqli_fetch_assoc result in a variety of ways and creating a new array within the

Add JSON keys/values while creating another JSON PHP

I am trying to pass some JSON keys/values that I have to another JSON I am creating dynamically. For example, this is the JSON I have in $json_create That comes over file_get_contents And this is the JSON I am creating Which print something like What I am trying to achieve is There is quite a lot on that subject but

Removing an associated key/value pair from array (nested)

I have two function to add remove parameters to the query string. The “add_query_params” (thanks to this forum) is working nicely and I can now add multiple tags to the query string of the same type. For example As you can see, I can add multiple of the same parameters, I am also querying these nicely using queryfilters. However my

PHP – How do I add a name to an array

I am building an array (json encoded) and returning it to the caller. My output currently looks like this: I want to add a name so that output looks like this: Here is my current code: I am fairly new to OO coding, so I have not figured out how to initialize an object so that “orgs” is present. Maybe

Advertisement