metalspawned Posted August 15, 2009 Share Posted August 15, 2009 Imagine yourself using Facebook to list some of your interests, like Favorite Books or Favorite Movies. In Facebook, you have one text field to enter as many names as you want, separated by commas. When viewing someone else's profile (or your own), you can click on an individual name (Star Wars, for example) to bring up a list of other people who are interested in that item. I'm trying to build something similar for my website. How should I store the data that is entered in the text field? I was thinking of storing it as VARCHAR, but I hear VARCHAR has a limit to the amount of data that can be stored. Should I store it as TEXT? Maybe BLOB? Beyond that, I'm not exactly sure how to approach the storage of the multiple items. Should I store the chunk of text as an array of, say, someone's Favorite Movies in one "cell" of my MySQL table? Or do I need to have separate tables for Favorite Movies, Favorite Books, with the USERID as the primary key of each table? Any directions would be greatly appreciated! :-D Thanks, ms Quote Link to comment https://forums.phpfreaks.com/topic/170359-storing-chunks-of-text/ Share on other sites More sharing options...
smerny Posted August 15, 2009 Share Posted August 15, 2009 maybe explode it and store them into varchar or tinytext Quote Link to comment https://forums.phpfreaks.com/topic/170359-storing-chunks-of-text/#findComment-898653 Share on other sites More sharing options...
smerny Posted August 15, 2009 Share Posted August 15, 2009 and I would actually use a separate table for those things, could use fields like the category, the user ID, and the name of the thing Quote Link to comment https://forums.phpfreaks.com/topic/170359-storing-chunks-of-text/#findComment-898655 Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 and I would actually use a separate table for those things, could use fields like the category, the user ID, and the name of the thing Agreed. Quote Link to comment https://forums.phpfreaks.com/topic/170359-storing-chunks-of-text/#findComment-903191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.