I am having a problem updating a table with the correct value from a drop down combo. The code below lists the correct value associated with the AccessGroupName, but the value for the AccessGroupID (which is an 'int') is not correctly passed to the SQL update string. The update string acutally works and updates everything, except the value for UserAccess. If someone could tell what I am missing here, I would appreciate it greatly. Should I just remove the strcomp?
Select Code:
Update Code:
Greg Grewe
West Chester, Ohio
Select Code:
Code:
<select name="AccessGroup" id="AccessGroup">
<?php
do {
?>
<option value="<?php echo $row_AccessGroups['AccessGroupID'];?>"
<?php if (!(strcmp($row_AccessGroups['AccessGroupID'], $row_Users['UserAccess']))) {echo "SELECTED";} ?>>
<?php echo $row_AccessGroups['AccessGroupName']?></option>
<?php
} while ($row_AccessGroups = mysql_fetch_assoc($AccessGroups));
$rows = mysql_num_rows($AccessGroups);
if($rows > 0) {
mysql_data_seek($AccessGroups, 0);
$row_AccessGroups = mysql_fetch_assoc($AccessGroups);
}
?>
Update Code:
Code:
$updateSQL = sprintf("UPDATE users SET UserAccess=%s, UserFirstName=%s, UserLastName=%s, UserName=%s, UserPassword=%s, UserEmail=%s WHERE UserID=%s",
GetSQLValueString($_POST['AccessGroup'], "int"),
GetSQLValueString($_POST['FirstName'], "text"),
GetSQLValueString($_POST['LastName'], "text"),
GetSQLValueString($_POST['User_Name'], "text"),
GetSQLValueString($_POST['User_Password'], "text"),
GetSQLValueString($_POST['EmailAddress'], "text"),
GetSQLValueString($_POST['UserID'], "int"));
Greg Grewe
West Chester, Ohio