Serialize() problem

Hi,

I am trying to insert an array into a mySQL database using the serialize function. When I echo the function onto the page it works and I get this:

a:1:{i:0;s:3:“111”;}

However, when I insert this exact same variable into my dabase, it becomes null and I get this:

a:1:{i:0;N;}

I am using wordpress and this is my code:

$serialized_xer = serialize($album_array);
      echo $serialized_xer;
      $wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '$serialized_xer' WHERE id = '$album_id' ");

All help is greatly appreciated.

Thanks

see mysql_real_escape_string(). read the docs carefully because it’s important to understand why and when you need to use this functions.