Posted by Oli Filth on 01/14/06 22:59
zek2005 said the following on 14/01/2006 20:39:
>
> I have a varchar field in my DB with numeric values separates by
> spaces.
Well this is generally a bad idea to start with - one of the principles
of good database design is atomicity, i.e. each field should contain
only one value.
i.e. instead of something like:
ID name values(VARCHAR)
================================
1 Alice 1 28 373
2 Bob 72 182 44
you should use two tables:
ID name
============
1 Alice
2 Bob
personID value(INT)
=====================
1 1
1 28
1 373
2 72
2 182
2 44
Not to mention that storing numeric values in a character-based data
type is a waste of space and processing time.
> I need to extract the numbers to create an array.
But if you must store your info this way, use explode() to extract the
individual values.
--
Oli
Navigation:
[Reply to this message]
|