Learn, Share, Build

168
September 29, 2017, at 11:35 PM

I have a question about best practices regarding storing custom user data in mysql.

Let me explain a bit.

Im working on a newsletter system, like Mailchimp etc.

We have a contact (email) We have contact details (name, lastname, phone, country etc.)

contact details can vary depending on the input fields the user wants the contact to enter in their forms, so no 2 users will save the data the same way, and is fully up to what they name their fields.

Our first approach was to store all "contact details" in JSON into 1 single column. But that proofed to be tough when having to filter, segment and search this data quick.

So my final question, how do you store custom defined data in a MySQL database, so that it can be handled easily, even in lists of 20.000 contacts etc.

Thanks

Answer 1

I'm surprised that people are voting to close this as too broad.

The way to structure your data in a relational database is very well defined.

Our first approach was to store all "contact details" in JSON into 1 single column

...and that does not conform to the definition. And that is why you had problems managing the data.

Yes, there are times when breaking the rules is a good idea - but you always start by following the first rules of normalization and only consider denormalizing your database if you have a problem you can't avoid.

READ ALSO
Learn, Share, Build

Learn, Share, Build

We have a potential client make this request for their website:

204
Learn, Share, Build

Learn, Share, Build

I am trying to upload Laravel Project to a a free server https://byethost/

222
Learn, Share, Build

Learn, Share, Build

My problem, When session timed out, i refresh the page and then i get 500 error:

237
Learn, Share, Build

Learn, Share, Build

Is there a simpler way than using PHP for forms?

223