[Solved] Serialize
Posted: Tue Mar 23, 2004 7:08 pm
Hi guys..im writing a page for a computer shop (my internship program).
they want to use database (mysql) and php to store the products details.
well..one of the my function uses "serialize". taking values from a form and store it in db.
and at first things worked well when i unserialize it and use the array until.........when i enter ie. 17" monitor .. it stop working.. i think its the " or ' character corrupt the array ?? i think 
so..is there any way around this? i tried to use preg_replace to replace the character to something else...
but it gives me "Warning: No ending delimiter '"' found in /home/..........."
any help or advise is greatly appreciated
they want to use database (mysql) and php to store the products details.
well..one of the my function uses "serialize". taking values from a form and store it in db.
Code: Select all
for ($i = 1; $i <=10; $i++){
$componentNameї] = $_POSTї'componentName'.$i];
$componentValueї] = $_POSTї'componentValue'.$i];
}
$componentName=serialize($componentName);
$componentValue=serialize($componentValue);so..is there any way around this? i tried to use preg_replace to replace the character to something else...
Code: Select all
function convertStringToSQLFormat($string) {
return preg_replace('"', '^', $string);
}any help or advise is greatly appreciated