Hello. I'm having a problem while updating a row in a database. Instead of updating it with variables (They aren't empty since I've tested them) the query I made removes any value in the fields I want to change.
$theme = mysql_escape_string($_POST['theme']);
switch ($theme){
case "default":
$extras = $_POST['theme_extras1'];
break;
case "classic":
$extras = $_POST['theme_extras2'];
break;
case "custom":
$extras = $_POST['theme_extras3'];
break;
}
$extras = mysql_escape_string(implode("}{",$extras));
echo $extras . " - " . $theme; //variables seem fine.
$sql = "UPDATE users SET theme = '$theme', theme_extras = '$extras' WHERE username='$username'";
$result = mysql_query($sql); //Problem with query.
if(!$result){
echo "<span style='color:red;'>" . mysql_error() . "</span>"; //no error
}else{
echo "<span style='color:green;'>The theme has been altered.</span>";
}
Anyone know what could be the problem here?
Thanks for any reply.