Ok, a new problem and I've been trying to fix it for the past 2 hours. What I'm trying to do is update the database by finding the belt in the table "belt_owner", and updating who owns it. I can connect, and get the current owners of it. My problem is trying to change the ownership of it.
There's a belt ("TV"), and the current holder in the database is "Trent Sinn". Whenever I try to change ownership of the belt (like, I enter my name as the new owner), nothing happens. It goes to the page it's supposed to, but doesn't update the table, or display a warning.
PHP Code:
/** FORM TO GET Title, New and Old Holder **/
<form action="update_list.php" method="POST">
<b>Belt:</b> <input type=text name=belt><br>
<b>Old Holder:</b> <input type=text name=old><br>
<b>New Holder:</b> <input type=text name=new><br><br>
<input type=submit name=get_holder value="Update Belt List">
</form>
/** UPDATE_LIST.PHP **/
<? require("conn.php");
$name = isset($_SESSION['admin_user']);
$get_holder = isset($_POST["get_holder"]);
$old = isset($_POST["old"]);
$new = isset($_POST["new"]);
$belt = isset($_POST["belt"]);
/*...*/
if(!$old){ $old = ""; }
if(!$new){ $new = ""; }
if(($get_holder) && ($belt != "")){
if($belt != "Tag Team"){
$query = mysql_query("UPDATE belt_owner SET $belt = '$new' WHERE $belt = '$old'");
if($query != FALSE){
echo("Successfully updated database.");
} else{
echo("Unable to update database. Reason: ". mysql_error());
}
} else{ ?>
<form action="update_tag_teams.php" method="POST">
<b>Member #1:</b> <input type=text name=mem1><br>
<b>Member #2:</b> <input type=text name=mem2><br><br>
<center>(or)</center><br><br>
<b>Team Name:</b> <input type=text name=name><br>
<input type=submit name=new_team value="Update Tag Team Titles">
</form>
<?}
}
mysql_close();
?>