I have a field gathering values that are sequences of numbers separated by a comma, such as: "1, 2, 3, 23, 41, 54"
I was using SQL within PHP to find a number within this field with LIKE, but the way I did it, if I wanted to find only 5, for example, it would find the 54 in the field I wrote up there, and that would be wrong.
$sql = mysql_query("select nm_linha from linhas where cidades_origem like '%$cod_cidades%' and ida like '%$cod_bairros%' and cidades_destino like '%$cod_cidades2%' and ida like '%$cod_bairros2%'");
source_city , ida and destination_city are bank columns; $ cod_cidades , $ cod_cidades2 , $ cod_buttons and $ cod_buttons are PHP variables with the numbers that I want to find.
How can I make the query search for the number in question preceded and followed by a space, before and after these spaces can there be any content (%)?