here's what i'm trying to do
i have a field in my database (options in table quebec_calendarcustomfield) used in vbulletin for calendar custom fields. I want to allow a group of users to add and delete fields...
So now i'm trying to make a page where my users are able to delete a field.
All fields are serialized and stored in quebec_calendarcustomfield WHERE calendarcustomfieldid = '1'
so i tryed to unserialize it, do a str_replace to delete the field i want, and serialize it back....
but i'm stuck at serializing back, i can't find out how to serialize the whole array
include("db.php");
$query = "SELECT options FROM quebec_calendarcustomfield WHERE calendarcustomfieldid = '1'";
$res = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($res)) {
$a = $row["options"];
$unseri = unserialize($a);
foreach($unseri as $value)
{
$hmm = str_replace("$legroupe", "", "$value");
echo $hmm;
}
echo "<br><br>";
$uhh = serialize($value);
echo $uhh;
$cc = mysql_real_escape_string($uhh);
$zxc = "UPDATE quebec_calendarcustomfield SET options = '$uhh' WHERE calendarcustomfieldid = '1'";
$res = mysql_query($zxc) or die(mysql_error());
}
$legroupe is a defined $_GET value and it contains the line i want to delete
$a = $row["options"]; is the serialized array of ALL the fields, including the one i want to delete