Jump to content

Multiple categories in one "cat" field


imimin

Recommended Posts

Does anyone have any ideas on this:

 

Can I put more than one category in a "cat" field (MySQL database) separated by commas or another appropriate delimiter and call one or more categories by a link such as:

 

http://patternsofjoy.com/gallery.php?cat=adult&cat=child (or some other format)

 

I really DON'T want to have to create multiple rows of the same data with the only difference being  different category data.

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/157722-multiple-categories-in-one-cat-field/
Share on other sites

I suppose you could use some sort of mind bending join using SUBSTRING_INDEX() if you really wanted to

 

What do you mean by this and how would I proceed?

 

And

 

Oh, there are plenty of ways to workaround this... they're just all bad ideas.

 

Why is it a bad idea?

Performance wise, it sucks.  Having to read through each CSV entry, parsing the string and determining if it is or isn't in a category...

 

Changing/updating/deleting the categories in a csv method is semi unreliable.  Why risk changing references to similar things such as "hat" and "chat", when you can edit them individually in one place?  If you had a few rows that had csv categories like "house, hat, baseball" and another "school, chat, fire"... I would be skeptical that EVERY time would would perfectly type a mysql query to update only things that are == hat, rather than %hat or something similar.

 

Take fenway's advice, it's good advice.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.