Hi
I will explain this the best I can, basically I am curious if its pluasable to store and call post data like so:
I have a form with fields like so
name, description, picture, gallery, filter
then there are another 4 text fields across by 8 down ie:
a a1 a2 a3 a4
b b1 b2 b3 b4 b5
c c1 c2 c3 c4 c5 c5
etc
etc
I was thinking about storing each row as one field in the database seperated by a symbol so I can explode the data when I need to call on it and echo it ie:
$sql = "INSERT INTO products (name, description, picture, gallery, data1, data2 etc..) VALUES
('$name', '$description', '0', '$gallery, '$a|$a1|$a2|$a3|$a4', '$b|$b1|$b2|$b3|$b4');
Im thinking that this would make for less work when inserting and calling on the data, or would I be better off inserting each text field posted into its own field within the table?
Thanks
Storing data + array
Moderator: General Moderators
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
If you don't need sorting and other special things you can do so... I have done it sometimes when I had to store user choices which only consisted of 1-9 so it was quite under control. I'm afraid if all the concatenated data gets past the set limit of field, it will get lost without any warning...Jim_Bo wrote:Basically the first field of each row holds the heading, each of the other three fields basically hold data like dimensions & pressure. So each field holds small amounts of different data .. each row being a different product with different specs
how should I got about it?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Hmmz,
I dont know if 2 tables would be needed, I was just thinking more along the lines of cutting the table from 43 odd columns down to 11 odd by performing the task in my first post.
The data held wont need to be searchable or anything, but there is an edit option which I thought explode could be used to read the data back ..
not sure is serialize() would work under this situation?
Which is best .. really im hunting for a way to have less columns in the table .. maybe its best I have a large number of columns?
Thanks
I dont know if 2 tables would be needed, I was just thinking more along the lines of cutting the table from 43 odd columns down to 11 odd by performing the task in my first post.
The data held wont need to be searchable or anything, but there is an edit option which I thought explode could be used to read the data back ..
not sure is serialize() would work under this situation?
Which is best .. really im hunting for a way to have less columns in the table .. maybe its best I have a large number of columns?
Thanks