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 Link to comment https://forums.phpfreaks.com/topic/100095-cant-execute-a-query-with-serialized-data/ 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? Link to comment https://forums.phpfreaks.com/topic/100095-cant-execute-a-query-with-serialized-data/#findComment-511813 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted April 8, 2008 Author Share Posted April 8, 2008 bump Link to comment https://forums.phpfreaks.com/topic/100095-cant-execute-a-query-with-serialized-data/#findComment-512457 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted April 9, 2008 Author Share Posted April 9, 2008 no help? Link to comment https://forums.phpfreaks.com/topic/100095-cant-execute-a-query-with-serialized-data/#findComment-512575 Share on other sites More sharing options...
discomatt Posted April 9, 2008 Share Posted April 9, 2008 mysql_real_escape_string() Link to comment https://forums.phpfreaks.com/topic/100095-cant-execute-a-query-with-serialized-data/#findComment-512577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.