Generate a Generic String with two table data - Codeigniter PHP

Asked

Viewed 31 times

1

I’m in a little trouble.

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

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 model:

"$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 several synonyms for a term, this would lead to several Ors. Just as I can have several TERMS, which would result in several AND’s. A SYNONYM exists only if it is tied to a TERM. A TERM need not necessarily have a SYNONYM.

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

Grateful dese ever!

  • 1

    Do you want to list all the terms and their synonyms, if they exist? If so, you settle with a left Join.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.