Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Keep It Simple, Stupid
 
PerlMonks  

Re: Storing multiple value field in a MySQL database

by boftx (Hermit)
on Nov 25, 2013 at 20:23 UTC ( #1064287=note: print w/ replies, xml ) Need Help??


in reply to Storing multiple value field in a MySQL database

There have been a number of replies now that give a more "ideal" solution. But let's take the OP at face value (as reinforced by a later comment) and accept that he has restrictions that preclude the "better" solutions.

Doing that yields the simpler (but not "ideal" from a DB perspective) of this:

my $memberstr = join('|',@member);

One should probably trim any possible leading and/or trailing whitespace just to be safe. Is this an ideal solution? No. Can it be converted to a better solution later if desired? Yes, and without much hassle.

So rather than point all the problems that the OP has with this (at great length in some cases) just take the OP at his word that he understands all of this and appears to have restrictions that dictate that the less than ideal solution be used.

It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.


Comment on Re: Storing multiple value field in a MySQL database
Download Code
Re^2: Storing multiple value field in a MySQL database
by itnomad (Scribe) on Nov 27, 2013 at 18:57 UTC

    Well said, boftx. I run into columns that have multiple values separated by commas now and then. It works fine and would be easy to refactor if need be.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064287]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-04-18 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (461 votes), past polls