0

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...

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by kira_
0

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..

Edited by kira_: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.