Need help with a weird SELECT...
Posted: Sat Sep 24, 2005 9:12 pm
Ok, I give up. I have a table that lists photos. One row is a varchar of category ids. In other words...
Where the categories field might contain something like this:
-- I've tried each with no results. :/
Anyway, I wan't to display all photos from a certain category. Haha, I know I didn't plan to well for that. This is what I've tried (to no effect):
ERRN, no results.
I know the best thing would be to have a row for each category, but the categories are rather dynamic themselves, and there are a lot of them.
Anyone have a solution?
Code: Select all
CREATE TABLE `photos` (
`id` smallint(4) unsigned NOT NULL auto_increment,
-- stuff
`categories` varchar(30) NOT NULL default '',
-- more stuff
FULLTEXT KEY `categories` (`categories`)
) ;Code: Select all
-1- -3- -8- -4-
or
1;3;8;4;
or
1 3 8 4Anyway, I wan't to display all photos from a certain category. Haha, I know I didn't plan to well for that. This is what I've tried (to no effect):
Code: Select all
SELECT * FROM photos WHERE MATCH (categories) AGAINST ('$cat');I know the best thing would be to have a row for each category, but the categories are rather dynamic themselves, and there are a lot of them.
Anyone have a solution?