Well, it took me all evening to figure it out, but I did. The SQL statement needed to be changed to
WHERE categories LIKE '%$cat%'
and now it works. I had found an old book on my shelf called "MySQL and Perl for the Web" and found an example in there that pointed me in the right direction. I also found a website that gives a concise description of the SQL commands and syntax:

        So all is well again!


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.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to