Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>But is it safe?</p> </blockquote> <p>As long as you properly escape the input, using an appropriate library to access the database (or at least use mysql_real_escape_string) then yes, it is safe. Or at least, not more risky then storing anything else, in terms of hacking the database.</p> <blockquote> <p>Is there any disadvantages or problem with using this method to store data on MySQL</p> </blockquote> <p>Yes, here are a few:</p> <ul> <li><p>It's not possible, or at least much harder, to query against anything in the "data" column. Say you want all users that live in London. You'll have to fetch all the "data" columns in the entire database and do the searching in PHP.</p></li> <li><p>It's also not possible to sort by anything in the "data" column when querying. It would have to be done in PHP.</p></li> <li><p>You have to take care of ensuring that the data stored is stored in the correct format. You should do this anyway, but it does remove an extra level of protection against storing "bad" data.</p></li> </ul> <p>It looks like you have essentially turned MySQL into a NoSQL database. Although my experience is limited of them, the are able to index + sort data in the stored documents/JSON data to some extent. As a relational database, MySQL can't: it can only sort + index the defined columns. You're getting the worst of MySQL, the difficulty of scaling, without using any of its advantages, namely being able to run complex queries.</p> <p>That being said if you are sure that you'll never need to run such queries, it might make it easier to move to NoSQL later if you store things as JSON.</p> <p>Edit: If you're concerned about using up space with empty columns, you can always add tables. Say a user-addresses table. This is actually quite a good way to be future-friendly if you might sometime need more than one address per user.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload