small serializing/unserializing problem
Posted: Fri May 16, 2003 8:12 am
I seem o not be able to get this right:
I serializing and sending data to a field in my table using serialze, it serializes and inserts the info correctly but when I call my info though it just displays 'array'
Does anyone know what my problem is, I have heard some talk about slashing data, could that be the problem or could it be something i'm unaware of
I am including the code so that everyone understands what I am getting at:
Thanks all
I serializing and sending data to a field in my table using serialze, it serializes and inserts the info correctly but when I call my info though it just displays 'array'
Does anyone know what my problem is, I have heard some talk about slashing data, could that be the problem or could it be something i'm unaware of
I am including the code so that everyone understands what I am getting at:
Code: Select all
<?php
include ("../scripts/conf.php");
$test = array (1=>'one',2=>'two',3=>'three',4=>'four',5=>'five',6=>'six');
$serial_test = serialize($test);
$query = "UPDATE sitecontent SET image = '$serial_test' WHERE Section = 'welcome' ";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
//$row = mysql_fetch_object($result);
//record into database
//once the data is retrieved, use unserailize
$test = unserialize($serial_test);
echo $test;
?>