Jump to content

cant execute a query with serialized data


gdfhghjdfghgfhf

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.