Good day y'all..
I was never introduced properly to PHP so I come here a lot to seek for help. xd anyways, I have a problem at the moment.. I can't set my enum values properly..
This is how it was added to a table named "joke":

ALTER TABLE joke ADD COLUMN visible ENUM('NO', 'YES') NOT NULL;

jokes.html.php:

<?php foreach ($jokes as $joke): ?>
	<form action="?" method="post">
    <input type="hidden" name="id" value="<?php htmlout($joke['id']); ?>"/>
    <select name="visible" id="visible"><br />
	<option value="">...</option><br />
	<option value="'YES'">Yes</option><br />
	<option value="'NO'">No</option><br />
	</select>
    <input type="submit" name="action" value="Set"/>
    </form>

index.php:

if (isset($_POST['action']) and $_POST['action'] == 'Set')
{
	$value = $_POST['visible'];
	include '../includes/db.inc.php';
	$id = mysql_real_escape_string($_POST['id']);
	
	// Change visibility
	$sql = "UPDATE joke SET VALUES visible='$value' WHERE id='$id'";
	if (!mysql_query($sql))
	{
		$error = 'Unable to set visibility.';
		include 'error.html.php';
		exit();
	}
	header('Location: .');
	exit();
}

So each time I try to update the visibility, I get the error message... I can't figure out what's wrong.. Thanks in advance...

problem solved.
changed

$sql = "UPDATE joke SET VALUES visible='$value' WHERE id='$id'";

to

$sql = mysql_query("UPDATE joke SET visible='$value' WHERE id=$id");

however, the error message still displays..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.