views:

13

answers:

1

Hello all. I'm in need of some quick help on matching a field in my database that stores all of the "parent" categories for my online store. Here's an example of how my "parents" are stored in the table via one field named Parent:

MENS MENS-BRANDS MENS-SHIRTS MENS-T-SHIRTS

Here is my query in PHP to perform the call:

$query = "SELECT id FROM $usertable where parent like '".strtoupper($parent)."'";

The problem is, if I am on MENS-BRANDS, this will also return those products who are listed in every other category because it contains the word "MENS." Since all of the parents are stored in one field, how can I make my SQL query only recognize each physical word that is separated by spaces in the field itself, instead of it trying to find every instance of different fragments of a word throughout the field?

I hope this makes sense, and any help is surely appreciated.

A: 
VoteyDisciple