title: Insert/Update MySQL into longtext Column
body: <p>How do I insert the following string into MySQL:</p>
  
  <pre><code>$myValue ouputs: [Hey, this is a multi text file that has special characters like this ' and this '' and this ,,"", and this ''' and this '''' and this !@$ and whatever]
  </code></pre>
  
  <p>But the following will not work because of special characters:</p>
  
  <pre><code>$sql = "UPDATE `mytable` SET NEWS=('$myValue') WHERE _id='1'";
  </code></pre>
  
  <p>I do not want to manually escape every character (like adding an ' before every ') </p>
  
  <p>Update/Insert should should start at [ and end at ] (as seen in $myValue)</p>
  
  <p>EDIT (mysqli)</p>
  
  <pre><code>    $_myValue = mysqli_real_escape_string($myValue);
  
      $conn = new mysqli($servername, $username, $password, $dbname);
  
      if ($conn-&gt;connect_error) {
          die("Connection failed: " . $conn-&gt;connect_error);
      }
  
      $sql = "UPDATE `mytable` SET NEWS='$_myValue' WHERE _id='1'";
  
  
          if ($conn-&gt;query($sql) === TRUE) {
              echo "Record updated successfully";
          } else {
              echo "Error updating record: " . $conn-&gt;error;
          }
  </code></pre>