Re: Multiple MySQL Queries

From: Date: Wed, 05 Aug 2009 04:29:41 +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-296315@lists.php.net to get a copy of this message
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: http://www.1keydata.com/sql/sql-commands.html So all is well again! Regards, Frank
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.


« previous php.general (#296315) next »