Ever wonder the effects of LIKE 'variable' and = ' variable ' in sql statement?
+---------------+-------------------------+
| departmentID | name |
+---------------+-------------------------+
| 1 | Test Department |
| 2 | Test Department22222 |
| 3 | Test3333 Department2 |
| 4 | Test55555 Department |
| 5 | test |
+---------------+-------------------------+
mysql> select * from department where name LIKE 'test@@@';
Empty set (0.00 sec)
mysql> select * from department where name='test@@@';
+--------------+------+
| departmentID | name |
+--------------+------+
| 5 | test |
+--------------+------+
1 row in set (0.00 sec)
@ = spaces
Moral of the story?
Use the function that ACCURATELY fits your needs. If not, you'll do more debugging than programming.