Inserting a chat message into a database : <p>So I use the following line of code to insert a chat message into my MySQL database: </p>

<pre><code>$this-&gt;db-&gt;query("INSERT INTO group_messages (group_message_text,group_message_group_id,group_message_user_id) VALUES ('$message','$group_id','$user_id');");
</code></pre>

<p>This works great until the users tries to use characters like ' or emoji's. How do I handle that properly? </p>
