View Single Post
  #15   Spotlight this post!  
Unread 29-06-2004, 13:43
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: PHP, MySQL, and Dropdown lists

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();
?>
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"