Search for string in SQL / PHP database

0

Good evening,

I have the following select that is to search for users according to their category:

$consulta = "SELECT * FROM app_usuarios WHERE  cat = '$categ'

$ categ is the variable that I get dynamically according to the user's choice.

I have the following categories registered to the bank: A, B, C, D, DM , E.

But when the search asks for the return of the categories "D" and "DM" the result returns empty, it only returns values when the chosen option is A, B, C and E.

What is wrong with my select ??

Thank you. Hugs

    
asked by anonymous 23.01.2017 / 22:06

1 answer

1

The solution found was the use of a LIKE, in the search:

$consulta = "SELECT * FROM app_usuarios WHERE  cat LIKE '$categ'
    
23.01.2017 / 23:35