changing a field
Posted: Thu Jan 22, 2004 3:21 pm
heres my code
in case you cant tell i want to change the "type" field where "user" is equal to $user, i don't think what i have is right....or if it is i got some problems
does anybody know how to do this?
Code: Select all
if(!isset($_POST['submit'])){
Print <<< EOT
<form method="POST" action="index.php?l=admin.php&admin=usertype">
User name: <input type="text" name="user"><br>
User type: <select name=type>
<option value=user>USER</option>
<option value=mod>MOD</option>
<option value=admin>ADMIN</option>
<option value=frozen>FROZEN</option>
</select>
<input type="submit" value="Submit" name="submit">
</form>
EOT;
}
else{
$user = $_POST['user'];
$type = $_POST['type'];
$sql = mysql_query("INSERT INTO user (type)
VALUES('$type') WHERE user='$user'");
if($sql){
echo $user." was changed to or has become: ".$type;
}
elseif(!$sql){
echo $user." was not changed";
}
else{
echo "Problem executing the script!";
}
}does anybody know how to do this?