title: mysqli_real_escape_string doesn't insert into db
body: <p>I propose the following question ... I have to make sure that the following query also accept values ​​with the quotes inside ..
  I tried using mysqli_real_escape_string but it did not work .. I am attaching my attempts ..</p>
  
  <p>1° Put the function during the post</p>
  
  <pre><code>        $idCantiere = $_POST["idCantiere"];
          $nomeCantiere = mysqli_real_escape_string($_POST["nomeCantiere"]);
          $sql = "INSERT INTO Cantiere( 
          idCantiere,
          nomeCantiere)
          VALUES(
         '$idCantiere',
         '$nomeCantiere')";
          if (mysqli_query($mysqli, $sql)) 
          {
          echo "&lt;script type='text/javascript'&gt;alert('Cantiere Inserto'); 
          &lt;/script&gt;";
          } else
          {
           echo "Error: " . $sql . "" . mysqli_error($mysqli);
          }
  </code></pre>
  
  <p>2° Put the function during the query</p>
  
  <pre><code> $idCantiere = $_POST["idCantiere"];
          $nomeCantiere = $_POST["nomeCantiere"];
          $sql = "INSERT INTO Cantiere( 
          idCantiere,
          nomeCantiere)
          VALUES(
         '$idCantiere',
         mysqli_real_escape_string('$nomeCantiere'))";
          if (mysqli_query($mysqli, $sql)) 
          {
          echo "&lt;script type='text/javascript'&gt;alert('Cantiere Inserto'); 
          &lt;/script&gt;";
          } else
          {
           echo "Error: " . $sql . "" . mysqli_error($mysqli);
          }
  </code></pre>
  
  <p>How can I solve the problem?</p>