Click here to Skip to main content
15,885,880 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created a table in phpmyadmin and i was curious to know if it is possible to assign multiple values to one variable/field in the same table. For example here is what i have:

ID | Shoe | Sizes
____________________
1 | CK | 7
____________________
2 | LV | 7
____________________
3 | Prada | 7
____________________
4 | Nike | 7
____________________
5 | Puma | 7
____________________


This is what I want:

ID | Shoe | Sizes
____________________________
1 | CK | 7, 7.5, 8, 8.5
____________________________
2 | LV | 7, 7.5
____________________________
3 | Prada | 7
____________________________
4 | Nike | 7, 8, 9
____________________________
5 | Puma | 6, 6.5, 7
____________________________

I am not sure if i made any sense (i don't mind re-clarifying what i said).

Also, is there a technique in displaying a table on a web page? I tried using php and searched google to see if i could find any solutions but i only confused myself more. So how can i pull the data and display it on the site?

Thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 29-Dec-13 19:53pm    
I don't even think it deserves any discussion. 1) Multiple values in one field: possible and simple, but quite silly: using a string; 2) displaying a table on a Web page? excuse me, it looks like some 50% of inquirers of this forum do just that. I would understand if such things were discussed by someone who never did any programming, not software developers. Honestly, let's dub in "off-topic" and just leave it.
—SA
Sergey Alexandrovich Kryukov 29-Dec-13 19:59pm    
Also, I looked through all you question and "answers" (in quotation marks because they are not answers) — there are only 5, but all are either abuse, or just bad, pointless. I'm almost sure some more were some more automatically removed for abuse. This is harmless, but pointless. I would advise you to think about it.
—SA

1 solution

I think you need a systematic learning on how to build a database-driven web application,

Your first ideas of putting multiple value in a single field is a big mistake, that is a violation of "first normal form" rule in relational database design. There is a good article on this 11 important database designing rules which I follow[^]. You can ask google for more information on relational database design and related matters.

Your next question about 'technique', minimally, you will need knowledge of the following areas:
1. Learn HTML[^]
2. Learn JavaScript[^]
3. Learn PHP+MySQL[^]

You should learn these in sequence, with patience and try out their examples.

Remember that "Rome was not built in one day".
 
Share this answer
 
v3
Comments
thatraja 30-Dec-13 5:22am    
5! for the last line
Peter Leow 30-Dec-13 5:24am    
Thank you. Happy New Year to you.
thatraja 30-Dec-13 5:26am    
I wish the same!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900