5
I have a table units that represents the number of dormitories of the buildings:
id| dorm
1 | 1|3
In this case above means that id 1 has units with 1 or 3 dormitories.
Then I have a search using $_GET
where the dormitory field is Dorm=2, for example
In this example I need the query to bring this id 1, because the person selected minimum 2 dormitories, and as in the Dorm column has 1|3 (which means that it has units of 1 or 3 dormitories) it must bring the id 1.
To make the query I would have to "break" the Dorm column, right? I don’t know how
just put () in Where, because I have other Ands in the query
– Leandro Marzullo
has a problem in this, if the dormitory has more than 1 character, it gives error, because it cuts in half
– Leandro Marzullo
Show me an example to see
– Sam
ex, id1 = Dorm 1|3. id2 = 10|8, id3 = 1|10.
– Leandro Marzullo
Leandro, I updated the answer... now do a test to see why maybe the value
$dorm
must be out of quotation marks....– Sam
it worked yes, then I tried to apply this same one to another, but it did not, this other one has 4 values: 20|35|115|10. you know how I can do for this case?
– Leandro Marzullo
I managed, I played one inside the other SUBSTRING_INDEX(SUBSTRING_INDEX(footage,'|',2),'|', -1)
– Leandro Marzullo