I have a column in my mysql table, where it is called "positions", where several values in int are placed there, however, with the "|" of division.
Example: 8 | 19 | 10 | 20 |
And each number represents a category.
I would like to do a SELECT where I having only a number, would select the records that had that number in the middle.
Example: I chose 8 to make the select in the table, where my column positions is equal to 8 | 19 | 10 | 20 |, as it has the number 8, it will return positively .
<?php
$id = isset($_GET['id']) ? $_GET['id'] : ''; // numero que vou selecionar
$sql = mysql_query("SELECT * FROM usuarios WHERE cargos LIKE '%$id%' OR cargos = '$id' ORDER BY id");
while($ver = mysql_fetch_array($sql)){
?>
I tried to do it this way, but it did not work out with the "LIKE".