• Advertisement
Sign in to follow this  


This topic is 4276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working with MS SQL and PHP. I am trying to write a script to update a database on a per-record basis. I retrieve the CustomerGUID, the company name, and the address field. After I manipulate the data in PHP, I want to save it back to the record in the corresponding record in the database. I do this with something like:
$query = "UPDATE Customer SET Address='$new_address' WHERE CustomerGUID='$guid'";
The problem is that the GUID is returned as a 16-byte binary structure, but the database only accepts updates where you specify the hexadecimal string equivalent. My question is... is there a predefined fnction or some easier way to update the records? I could write a function myself to pick out the bytes and convert them to hex, but 1) that takes a lot of effort and 2) it seems like there would be an easier way. Thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement