Jump to content

How best to handle this data


mapleleaf

Recommended Posts

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?

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.