I have a field with enums: ‘preview’,’active’,’closed’
When I query like this:
$query = "UPDATE albums
SET album_active = preview
WHERE album_id = 3";
$result = mysql_query($query);
if (!$result) die('Invalid query: ' . mysql_error());
I get:
Invalid query: Unknown column 'preview' in 'field list
Other query:
$query = sprintf("UPDATE albums SET
album_active = %s
WHERE album_id = %d",
$_POST['album_active'],
$_POST['album_id']
);
Try putting
previewin quotes as:Without the quotes
previewwill be recognized by the query parser as a column name, something like: