I have two tables, one consisting of ID and FNAME (ex, 01 Google), the other ID, FIRSTNAME, SURNAME (ex 01 JOHN DOE).
The ID in the last database connects the user with an organization (f.ex Google that has ID 01 here).
I'm trying to get these into a JSON via json_encode, but I can't for the love of me figure out how I can connect the two results I get.
The users are supposed to be sorted by organization.
Ex:
{"Google":["John Doe","Paul"],"Microsoft":["Bill Gates"]}
I really don't have any code-example, since I can't get anything to remotely working. I'm trying to put it into arrays in the while-loop, but the format goes all wrong - so goes the sorting.
->fetch()is. 4. build array with the results. 5. run array through json_encode().