I’ll admit, I don’t know tons about MySQL queries or JSON for that matter but I would like to. Currently when I get data from my database I query one table which brings values into another query and so on. I don’t think this is the best practice to go about receiving all the data I need to display. Below is an example of how my MySQL queries currently work in a PHP foreach function:

So, is there a better way of completing the query(s) I want and how would I be able to encode it as JSON?
Any help would be appreciated, thank you.
From what I understand, your code is doing something like this:
With this, you’re making the process more complex than it needs to be. You can get all of the information you need with one query with a
JOINlike this:That will give you the name, status and whatever else of everyone who is friends with
MyCurrentProfileID. Then, you just need to put the result in an array andjson_encodeit: