gdfhghjdfghgfhf Posted April 8, 2008 Share Posted April 8, 2008 i'm tyring to do an UPDATE on a field and i want to put a serialized string.... so it includes double quotes and others weird symbols.... so it's breaking my sql query how can i solve this? i need to preserve the syntax of my serialized string with the double quotes intact or else it wont work right Quote Link to comment Share on other sites More sharing options...
gdfhghjdfghgfhf Posted April 8, 2008 Author Share Posted April 8, 2008 here is the code: $a = $row["options"]; $ary = unserialize($a); $ary[] = $title; $b = serialize($ary); $zxc = "UPDATE quebec_calendarcustomfield SET options = '$b' WHERE calendarcustomfieldid = '1'"; so the sql query will look like this UPDATE quebec_calendarcustomfield SET options = 'a:4:{i:1;s:7:"option1";i:2;s:7:"option2";i:3;s:7:"option3";i:4;s:3:"etc";}' WHERE calendarcustomfieldid = '1' see? Quote Link to comment Share on other sites More sharing options...
gdfhghjdfghgfhf Posted April 8, 2008 Author Share Posted April 8, 2008 bump Quote Link to comment Share on other sites More sharing options...
gdfhghjdfghgfhf Posted April 9, 2008 Author Share Posted April 9, 2008 no help? Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 9, 2008 Share Posted April 9, 2008 mysql_real_escape_string() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.