Insert a text mixed with double and single quotes into the sql database

I have a form and I let users type some additional details for the form. What if the user enters a text mixed with single and double quotes.

ex:- I’d like to join. So we”are party”this”time’addtional’details`willbe”

I found out that, because of this text, nothing goes into the database. It means literally this thing crashes my whole program.

How do I enter it into the database using PHP or MySQL query?

I’ve tried these methods

  • Backslashes (‘)

  • JSON encode

  • str_repalce

  • htmlspecialchars with ENT_QUOTES

But nothing works for me!