mapleleaf Posted February 12, 2011 Share Posted February 12, 2011 I have a form where some users are compiling extracts from another part of my database. The source text has unique IDs. The users know these IDs and when they add the extracts. They need to be able to say which paragraph they are pulling from the the original text along with the ID. There can be multiple source texts. At the moment I am going to get them to send the source info like this: 1982,3,4|783,1|999,4,6,7 ID,p,p|ID,p|ID,p,p,p The first number is the source ID and then after each comma is the paragraph till you get to a pipe which marks the beginning of a new source. So in this case 3 sources. I can handle getting the info out of the string. My question is how best to store this in the database. It looks like I will need to store the string and pull it apart each time it is used but is there a better way? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 13, 2011 Share Posted February 13, 2011 As long as you're not searching for a specific part of this string, it doesn't matter how it's stored. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2011 Share Posted February 13, 2011 As long as you're not searching for a specific part of this string, it doesn't matter how it's stored. You mean searching the database for a specific part, right? Not searching through a string that you've returned for a specific part. Quote Link to comment Share on other sites More sharing options...
fenway Posted February 13, 2011 Share Posted February 13, 2011 Correct. Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted February 18, 2011 Author Share Posted February 18, 2011 I'd like to be able to get each paragraph and its id as I will need to connect them up to the original source ids. So yes I'd like each id and its paragraphs available without pulling apart the string. I am happy to have another table if it helps. Starting to think a table with the the unique ids having another relationship id as the primary field. so : relationship_id : auto increment primary extract_id:(pulled from last insert for the extract) source_id:1982 paras: 2,3 Does any one have a better solution? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 18, 2011 Share Posted February 18, 2011 Huh? Quote Link to comment 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.