2
I have the following situation, a register with 5 fields being them: Type1, Type2, Type3, Type4 and value
The 4 type fields are combos fields, where you can select the all option, or any other option.
To illustrate:
<select class="form-control" id="tipo1" name="tipo1">
<option value="" selected>TODOS</option>
<option value="1">Opção 1</option>
<option value="3">Opção 2</option>
...
</select>
<select class="form-control" id="tipo2" name="tipo2">
...
So far so good, is working ok. In Mysql I have the following situation
Id Tipo1 Tipo2 Tipo3 Tipo4 Valor
1 1 Null 2 3 100.00
Obs.:
- The 4 types cannot be null at the same time.
- It can happen that type 1, or Tipo2 or type 3 is filled and all other types are null.
To contextualize, this is a goal register, which depending on the situation and the value if it was exceeded, should pass, or block.
I am using PHP and Mysql, my problem is to make a query if the situation exists in the bank, I am not able to see how to do it. I do not know if I could be clear, and it may be that the answer is in front of me, but I have already broken my head enough and nothing came out, so I decided to ask for help. hehe.
I didn’t quite understand your question, you’re having trouble executing the query in the database and returning a certain situation, that’s it?
– Ricardo Pontual
I think so, @Ricardopunctual. Scussel, please specify the "certain situation" you are looking for.
– Marllon Nasser
Do you want the query to fail if the 4 fields are Null or do you want to check this at the front/backend ? The problem is when to search or do not want to insert with the 4 nulls ?
– Lucas Queiroz Ribeiro