title: Inserting a string in MYSQL through Perl
body: <p>The problem I am having is that I have a user input a string... Could be anything less than 156 characters, and the DBI statement inserts the string perfectly if there are no apostrophes or quotation marks in the string. </p>
  
  <p>This works fine-> I am working!
  This doesn't work-> I'm not working!</p>
  
  <p>To insert I use the following code:</p>
  
  <pre><code>    $sth = $dbh-&gt;prepare("INSERT INTO table VALUES('$var1','$var2','$var3')");
      $sth-&gt;execute();
  </code></pre>
  
  <p>I know that Perl interpolates the strings different with ' ' and " " but my program throws a fit when I try that. I've also tried using a join to join that prepare statement together using " " marks. The variable that stores the 155 characters is $var3 if that matters, and all 3 are VARCHAR attributes. Any suggestions?</p>