Web Hosting Talk







View Full Version : Enum Problem


-Edward-
08-01-2003, 05:09 AM
Ok,

I'm using enum to make fields visible and invisible on my website, i can display them find depending on whether i want Y or N to be displayed.

the bit of the form on my page is:

<input type="radio" name="sVisible" value="N" checked="checked" />
N
<input type="radio" name="sVisible" value="Y" />
Y / currently: <?php echo $sVisible; ?>

i have this inserted in my update command:

sVisible='$sVisible'

this shows what it's currently set at:

$sVisible = $author['sVisible'];

So i can display what it's set as but when i click update it doesnt change from N to Y if i change it's option.

Field is Called sVisible

the type is ENUM

Length/values is: 'N','Y'

null = not null

Default = N

Thats how it's setup any ideas?

Alan @ CIT
08-01-2003, 06:19 AM
Hi,

Just a thought - try using $_REQUEST['sVisible'] instead of just $sVisible. Does doing an "echo $sVisible" after the submit show the correct result? If so, can you post your sql update query, as it will probably be a problem in that.

Thanks,
Alan.

-Edward-
08-01-2003, 07:33 AM
Error updating author details: Query was empty

is what is outputted.

my update query is:

$userid = $_POST['userid'];
$profile = $_POST['profile'];
$email = $_POST['email'];
$why = $_POST['why'];
$sVisible = $_REQUEST['sVisible'];
$id = $_POST['id'];
$sql = "UPDATE user SET
userid='$userid',
email='$email',
shared='$shared',
shared1='$shared1',
shared2='$shared2',
why='$why',
profile='$profile',
sVisible='$sVisible'
WHERE id='$ID'";

VH-Robert
08-01-2003, 08:08 AM
Hi. :D

What is Enum? Thanks.

-Edward-
08-01-2003, 08:44 AM
http://www.mysql.com/doc/en/ENUM.html

-Edward-
08-01-2003, 08:59 AM
got it going :)