We are Designers, We are Developers,We are Thinkers,
We are Strategists

How to save multiple input entries in one column in mysql using php?

  • 0


Serialization method – serialize() is to store multiple fields in single column. PHP is able to automatically serialize most of its variables to strings – letting you save them into storage like $_SESSION. However, there are some tweaks you have to know to avoid exploding .php scripts and performance problems.

serialize() converts an array, given as its only parameter, into a normal string that you can save in a file, pass in a URL, etc. Unserialize()┬áis the opposite of serialize() – it takes a serialized string and converts it back to an array.


On Post request you have received $_POST data for name, mobile, address, email.

$data = $_POST;
$data_serialize = serialize($data);


resulting array will be


use this serialized string to insert into database.

Unserialize value from DB:

$data_unserialize = unserialize($records_serialize);

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.