Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.