title: How verify the bad characters and canceled their effect from your input content ? (MySQL Request / Joi)
body: <p>I created a form where the user can enter their information.
  I use Joi to validate the content of the form and MySQL to communicate with my DB.</p>
  
  <p>Unfortunately if my user enter a " ' " in the input, I have a syntax ERROR from MYSQL.
  How can I change that automatically ? 
  I tried to replace ' by \', but I don't know if it's the good way ... I feel is not.</p>
  
  <p>My validation model don't check the dangerous character like ' or \ or ". I would like to keep them in my DB but safely. I would like that my user can enter "It's..." if he want.</p>
  
  <p>This is my validation model:</p>
  
  <pre><code>function validateUser(user){
      const schema = {
          firstname: Joi.string().required(),
          lastname: Joi.string().required(),
          phone: Joi.string().required(),
          bestcontact: Joi.string().min(5).max(5).required(),
          mail: Joi.string().optional().allow(null).allow(""),
          address: Joi.string().allow(null).optional().allow(""),
          suburb: Joi.string().allow(null).optional().allow(""),
          state: Joi.string().allow(null).optional().allow(""),
          postalcode: Joi.string().allow(null).optional().allow(""),
          birthday: Joi.date().allow("").allow(null),
          iduser: Joi.number().optional()
      };
      return Joi.validate(user, schema);
  }
  </code></pre>
  
  <p>This is my SQL request:</p>
  
  <pre class="lang-sql prettyprint-override"><code> const queryString = `INSERT INTO user (\`iduser\`,\`firstname\`, \`lastname\`, \`phone\`, \`mail\`, \`address\`, \`suburb\`, \`state\`, \`postalcode\`, \`birthday\`, \`bestcontact\`) VALUES ('${user.iduser}','${user.firstname}', '${user.lastname}', '${user.phone}', '${user.mail}', '${user.address}', '${user.suburb}', '${user.state}', '${user.postalcode}', '${user.birthday}', '${user.bestcontact}');`
  </code></pre>
  
  <p>Thanks in advance</p>