How to use LIKE in a SQL statement to look for a number followed by the "_" character within the contents of a field?
Ex: how to look for 19_ or 21_ ?
I know that _ is a reserved wildcard.... but I would need to use it here as an actual character... THANKS!!
I have a classes table. Each class has a users text field. The text field looks like this (for a record):
19_m~43~2~4-m~45~0~0-m~46~0~0-m~47~0~0-m~48~0~0-m~49~0~0-m~50~0~0-m~51~0~0-t~6~0~0-t~7~0~0-t~8~0~0-t~9~0~0-m~52~0~0-m~53~0~0-m~54~0~0-t~10~0~0-t~11~0~0-t~12~0~0-t~13~0~0|21_m~43~0~0-m~45~0~0-m~46~0~0-m~47~0~0-m~48~0~0-m~49~0~0-m~50~0~0-m~51~0~0-t~6~0~0-t~7~0~0-t~8~0~0-t~9~0~0-m~52~0~0-m~53~0~0-m~54~0~0-t~10~0~0-t~11~0~0-t~12~0~0-t~13~0~0
The user ids are the numbers that have _ after them. In this example, 19_ and 21_.
What I am trying to do is to
select * from the classes table where a certain user (number followed by _)
is present in this USERS field.
I tried something like [...] prepare
("SELECT * from classes WHERE USERI LIKE '".$id."\\_%'")
but would not get me this record... it returns an empty result.