Skip to content
Advertisement

How to perform couple of mysqli queries and add one result into existing result array?

Need to perform couple of mysqli queries and add one result into existing result array, currently I have implemented first query,

JavaScript

The result is like,

JavaScript

Now I want to perform another query,

“SELECT * FROM directors_table WHERE director_id = $dir_id”

and add the result into json response as director object,

JavaScript

Advertisement

Answer

Use a JOIN in your query:

JavaScript

And build the array structure in your loop:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement