Hello I have a column that stores ids separated by a comma, ex:

ID..................TREE

1...................1,57,51,52
2...................1,23,58
3...................1,57,51,52,53
4...................1,56,23
5...................1,57,51,52,55
6...................1,34
7...................1,60,5289
8...................1,61,527
9...................1,45852

The purpose of the TREE column is to serve as a breadcrumb pointer in a herarchical tree structure... so each id separated by comma is parent to the previous one.

What I am trying to accomplish is to search through the breadcrumbs to identify which of them contains a certain id and then explode them into an array using php.

For example, if i wanted to know which contains the number 52.

I have used LIKE and REGEXP but they show me not only the records that contain 52 but also any number that begins or ends with 52 like 527, 5289 or 45852.

How can I filter only the records with the number 52 (In this case for example ids: 1,3,5 .... and not 1,3,5,7,8,9 because ids 7,8 and 9 just have numbers that begin or end with 52 but not 52 itself).

I also tried full text search but I might not be using it correctly.

Here are some sql queries i have used without success:

PHP Code:
USING LIKE
"SELECT * FROM table WHERE (tree LIKE '%52%')";
"SELECT * FROM table WHERE (tree LIKE '%52,%') or (section_arbol LIKE '%,52%')";

USING REGEXP
"SELECT * FROM table  WHERE tree REGEXP '{52}'";
"SELECT * FROM table  WHERE tree REGEXP BINARY '{52}'";
"SELECT * FROM table  WHERE tree REGEXP '[[:<:]]{5}' AND '[[:>:]]{2}'";

USING FULL TEXT SEARCH
"SELECT * FROM table WHERE MATCH(tree) AGAINST('52')";
"SELECT * FROM table WHERE MATCH(tree) AGAINST('\"52\"' IN BOOLEAN MODE)"
What am I doing wrong?

thanks !!! :0)