Hi, I have a similar problem at the moment. I was waiting to scrape together an example, but since you posted first I will jump into the discussion now. My problem is that I have a large array (without any funnies like self-referencing) getting serialized. There are some funnies in the string fields though (like `'`s etc). After making a roundtrip to the mysql database, things start to get bad on me since I cannot unserialize the text anymore. This only happens for some of the arrays that I have. Other arrays with similar data can get serialized and unserialized just fine. I do suspect though, that the problem lies with how I am using addslashes and how I am not using it. Any definitive help would be much appreciated. pieter On 5/16/05, Petzo <petzo@xxxxxxxxx> wrote: > > Hi, > > My question is about the norlmal behaviour of PHP and MYSQL but I cant > explain it without a simple example. Thank you for reading: > > I have the following code: > -------------------------------------------------------------------- > <?php > print $t = $_POST['txt']; > print $t = addslashes($t); > > @ $db = mysql_pconnect(xxx,xxx,xxx); > mysql_select_db('test'); > > $q = "update ttable set ffield='$t'"; > mysql_query($q); > > $q = "select * from ttable"; > $result = mysql_query($q); > $bo = mysql_fetch_array($result); > > print $t = $bo['ffield']; > print $t = stripslashes($t); > ?> > -------------------------------------------------------------------- > > from a HTML form I send variable: > -------------------------------------------------------------------- > ' \ \' \\ \\\ > -------------------------------------------------------------------- > > after addshashes it becomes: > -------------------------------------------------------------------- > \' \\ \\\' \\\\ \\\\\\ > -------------------------------------------------------------------- > > after that it gets in the database > > but after I get it out it becomes: > -------------------------------------------------------------------- > ' \ \' \\ \\\ > -------------------------------------------------------------------- > (without the backslashes!) > > and ofcourse after stripslashes it gets messed-up: > -------------------------------------------------------------------- > ' ' \ \ > -------------------------------------------------------------------- > > So my question is if this is a normal behaviour for PHP+MYSQL or it may > vary > indifferent conficurations or versions of both php or mysql. > It's not a bad thing to be like that but I wonder if my code will behave > the > same at most systems. > > Thank you very much > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- "Maybe I'm a little bit crazy, but I can't decide if it's psychotic or neurotic. You know the difference, don't you? A psychotic thinks that 2 + 2 = 5. A neurotic knows that 2 + 2 = 4, but it makes him nervous." - Larry Wall, The State of the Onion (speech) 2004. http://www.perl.com/pub/a/2004/08/18/onion.html