title: How can I escape an ampersand in php before sending to a db?
body: <p>Wierd thing is happening when I send data to my database. Anything after the ampersand is dropped as if it were never typed and everything before it is left intact. Can someone please tell me what I should use to preserve this character? REGEX? PHP function?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>code:</p>
  
  <p>// The POST var contains data entered by the user so could be anything really. This is coming from a WYSIWYG editor.</p>
  
  <p>$string = addslashes($_POST['txtarea']);</p>
  
  <p>mysql_query("INSERT INTO...'$string'");</p>
  
  <hr>
  
  <pre><code>        WYSIWYG.updateTextArea(n);
          var form = WYSIWYG_Core.findParentNode("FORM", this.getEditor(n));
          if(form == null) {
              alert("Can not submit the content, because no form element found.");
              return;
          }
          form.submit();
  </code></pre>
  
  <p>I want to echo the string out of what is being submitted. Can someone tell me what I need to place into this case to do that please? Is it alert(n)?</p>
  
  <hr>
  
  <p>OK guys.. I got it to echo. I'm using an AJAX interface for this and just echo'd the values from there. WHen I add an ampersand in the the string, I get:</p>
  
  <pre><code>test&amp;amp;&amp;amp;
  </code></pre>
  
  <p>So.... it's <strong>not</strong> the editor..</p>