title: Converting a binary variable to a hex representation for mySQL statement in PHP
body: <p>I'm coding a tool to insert test data into a database.  Some of the fields are blobs which are the (mcrypt) encrypted representations of strings.</p>
  
  <p>I'm creating binary variables, but can't find a way to properly output it in the format I see in PHPmyAdmin when I export (known good) data as a reference.  </p>
  
  <p>For example: </p>
  
  <p>I used PHPmyAdmin to export a known string.  It produces a value of 0xe07861bbcaf39ad54a0b85389a9f08886997f8cafffe871b8569c2fcf3293bcc in the VALUES list.</p>
  
  <p>Running bin2hex on my binary field (which I've confirmed contains the same contents as known good data) results in a representation of 7a49e1b3d7c6357cab6b4f9c61bc4d8535c23cbc8789e28ce9321993e9372c80</p>
  
  <p>I can't find any documentation on how to properly convert binary PHP data to the (hex) format that mySQL uses.  I've read the similar questions that seem related.</p>
  
  <p>How can I get from a binary field to the 0x.... value that PHPmyAdmin makes?</p>