MySQL Forums
Forum List  »  Newbie

multiple table update
Posted by: John Pearson
Date: March 23, 2005 09:12PM

OK here is the delema,

I have a site which i want to use to keep a ranking system so i have bacically 4 drop menus.


[---------------------------------------------------------------]
[ Winners Losers ]
[ Choice a - drop down Choice b - drop down ]
[ Choice c - drop down Choice d - drop down ]
[ game type - drop down ]
[---------------------------------------------------------------]

OK heres my dilema i can get winner a and loser b to update when submitted but i am unable to update winner c and loser d.

Also winner a and winner c recieve wins under the game type which works but loser b and loser d wont update.

Here is code im using can anyone help??


$sql = "UPDATE $players SET loss = loss + 1 WHERE name = '$losernamea'";
$result = mysql_query($sql);

$sql = "UPDATE $coaches SET win = win + 1 WHERE name = '$winnernamea'";
$result = mysql_query($sql);

$sql = "UPDATE $matchtype SET loss = loss + 1 WHERE name = '$losernamea'";
$result = mysql_query($sql);

$sql = "UPDATE $matchtype SET win = win + 1 WHERE name ='$winnernamea'";
$result = mysql_query($sql);

$sql = "UPDATE $players SET loss = loss + 1 WHERE name = '$losernameb'";
$result = mysql_query($sql);

$sql = "UPDATE $coaches SET win = win + 1 WHERE name = '$winnernameb'";
$result = mysql_query($sql);

$sql = "UPDATE $gametype SET loss = loss + 1 WHERE name = '$losernameb'";
$result = mysql_query($sql);

$sql = "UPDATE $gametype SET win = win + 1 WHERE name ='$winnernameb'";
$result = mysql_query($sql);


This is code for drop down menus(all are the same)

<select size="1" name="winnername" style="background-color: <?php echo"$color5" ?>; border: 1 solid <?php echo"$color1" ?>" class="text">
<?php
$sortby = "name ASC";
$sql="SELECT * FROM $playerstable WHERE approved = 'yes' ORDER BY $sortby";
$result=mysql_query($sql,$db);
$num = mysql_num_rows($result);
$cur = 1;
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$name = $row["name"];
?>
<option><?php echo "$name" ?></option>
<?php
$cur++;
}
?>
</select>

Options: ReplyQuote


Subject
Written By
Posted
multiple table update
March 23, 2005 09:12PM
March 24, 2005 07:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.