1

It came to my mind that is it possible to store more than one value inside one cell in a mysql table using php and then retrieve every value through php.I will provide an example to make it more clear.

Example:

Suppose, i have the first column of text type and the very first field of that column i.e. mysqltable[0][0]. Is there any way i can save multiple values inside this field in this way value1;value2;value3; and so on in the rest of the fields inside the column ?if yes, then how can i do this and retrieve the very same using php?

10
  • 1
    Yes u can along with any seperator like commas... But its not normalized Commented Feb 20, 2016 at 10:01
  • 3
    Yes it's possible, and it always raises a mass of issues and performance problems, and requires a lot more complexity in your code to access/update/etc that data; don't do it..... normalise your data properly Commented Feb 20, 2016 at 10:02
  • 1. you can store, separated string values (on fetching time explode by , and get all values in form of array). 2. you can save serialized array into the fields(on fetching time un-seriaialize it). 3.you can store json-encoded data (on fetching time decode it) Commented Feb 20, 2016 at 10:03
  • yeah but still i would like to know how it is done ? @MarkBaker Commented Feb 20, 2016 at 10:04
  • 2
    If you do really want to get clever, then upgrade to MySQL 5.7 and use the JSON datatype..... at least you can apply indexes to elements within that Commented Feb 20, 2016 at 10:08

1 Answer 1

5

Yes, you can insert values in your database. You should try to implode that string with , separated string values to insert that and fetch that values in a your form with explode() function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.