Generate a Generic String with data from two tables - Codeigniter PHP

1

I have a little problem.

I am developing a system for learning, but one of the requirements that I "invented" myself is to generate a base string. I'll try to drill down.

Tenho a tabela **term** com os seguintes campos:
term_id
term

Tenho a tabela **synonymous** com os seguintes campos:  
synonymous_id
term_id
synonymous

The idea is that I can print something on this template:

"$term1" OR "synonymous1" OR "synonymous2" AND "$term2" OR "synonymous3" OR "synonymous3".

I do not know if it was clear. But basically I will be able to have multiple synonyms for a term, this would entail several OR's. Just as I can have multiple TERMS, which would result in multiple AND's. A SYNONYM exists only if it is linked to a TERM. A TERM does not necessarily have a SYNONYMS.

Any suggestions of which way should I start to produce this algorithm? I wanted to add to my project which is basically in php with JS scratches.

Thank you already!

    
asked by anonymous 08.06.2018 / 09:23

0 answers