Jump to content

Inserting data into the same field - mysql approach?


CookieMonster94
Go to solution Solved by dalecosp,

Recommended Posts

I have a set of records which display details about various people. One column is additional information/facts. I would like people to be able to add as many facts as they like via a form and this be stored in the database. I do not want to overwrite what is currently there. I'm currently looking for ideas as to how to approach this task i.e. how to store this information. Should this be stored as a array, in a separate table etc. Any help would be greatly appreciated.

Link to comment
Share on other sites

  • Solution

Well, the first technical constraint would be the data type of the current "additional information/facts" column. How much data will it hold?

 

Because you can CONCAT things in SQL:

 

//let's add data about this person and delimit each statement with a semicolon ...
update people_details_table set additional_info = concat(additional_info,'; ',$yet_another_fact) where id = $some_number;
EDIT: speaking of "additional info", you seem to have posted the same question twice. Is it possible to undo that? Edited by dalecosp
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.