title: Encrypt text in PHP and decrypt in MS SQL
body: <p>As the title of the post says, I am testing a bit of code where I enter data on my form, then encrypt all the fields using MD5 (or whatever you think is best) and send it to my MS SQL Database.</p>
  
  <pre><code>$query = "INSERT INTO table_hide(firstname,last) 
  VALUES('".md5('Gary')."','".md5('Long')."');
  </code></pre>
  
  <p>Of course the database data is encrypted and I would like to read it.</p>
  
  <p>I am also aware of using EncryptByPassPhrase and DecryptByPassPhrase in MS SQL to Encrypt and Decrypt a password. However, I would like assistance in using the same <code>"key"</code> in the website to encrypt and on the SQL server to decrypt</p>
  
  <p>So my question is, how would I encrypt my data I'm sending to my database and then have that same key in my database to decrypt it.</p>