Sign in to follow this  


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this