Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way of storing text for MySQL tables [closed]

I'm developing a board that allows people to list and search for Minecraft servers (that people have submitted).

I'd like to give people the ability to submit a short, 300 word description about their server when submitting it, however, I'm unsure what the best way to do it would be.

I was thinking of having a separate table from my main table purely for storing this information as TEXT. The information about the server would be retrieved from the table via GET method.

Is this all sound? Is there a better way to store a somewhat small amount of text?

like image 399
Battleroid Avatar asked Jan 27 '26 13:01

Battleroid


1 Answers

  1. TEXT as your datatype for a new col in your *servers table (no need for a new table, unless this data has a relationship with other tables).
  2. Use prepared query's when inserting into your database.
  3. Use htmlspecialchars() when displaying back to your users.

Optional strip all html and allow limited bbcode or markdown

like image 198
Lawrence Cherone Avatar answered Jan 29 '26 03:01

Lawrence Cherone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!