Re: Multiple MySQL Queries
| From: | sono-io at fannullone dot us | Date: | Wed, 05 Aug 2009 02:59:45 +0000 |
| Subject: | Re: Multiple MySQL Queries | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296311@lists.php.net to get a copy of this message | ||
I've run up against something else here that I can't find an answer for. This line of the script:
$cats = array('01100-01200-01300-06403' => 'Starter Units', '01100-02201-01300-06403' => 'Add-On Units', '01100-99222-11341-18451' => 'Extra Shelves');
is supposed to pull all items from each category and gives each table a heading. Unfortunately, if a product in the db has more than one category assigned to it, it will not show up in the generated table. So, if an Extra Shelf has a second category, the categories are stored as 01100-99222-11341-18451``07108-05253-12341-01451 and if it has 3 categories assigned to it, they're stored like 01100-99222-11341-18451`
07108-05253-12341-01451`07108-01254-39341-01451, and so on.
Is there a way that I can tell the array to find all products whose categories either equal exactly the category I'm giving it or if it _contains_ that particular category? I've tried using the * wildcard but that didn't work. I've also tried WHERE categories CONTAINS '$cat' but that didn't work either.
Any insight into this would be greatly appreciated. If I can't find a fix for this problem, this whole script is useless to me, as most of our products have multiple categories and so it will only display a portion of the products that it should, if any at all.
Thanks a million,
Frank