hash2mysql function for taking a hash and dynamically generating the insert or update