Skip to content
Advertisement

Tag: junction-table

How can I fetch results from a junction table and insert them as an array into a JSON object using PHP?

I have Articles with Categories in a mysql Database. I would like to print out all Articles with their corresponding Categories as JSON in PHP to fetch with my Vue-App. I’m working with the following tables: Articles, Categories and Article_has_Category (junction table, many to many): The following PHP-Code selects and prints all Articles for my Frontend to fetch: Is it

Advertisement