Jump to content

Recommended Posts

Thanks for all of your help on this subject -

I have two pieces of code - the first set of code is here:

[code]

<html><head><title></title></head>
<body>
<?
$ud_id=$_POST['ud_id'];
$ud_score1=$_POST['ud_score1'];
$ud_score2=$_POST['ud_score2'];
$ud_diff=$_POST['ud_diff'];

//connect to db with password above this line
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());

mysql_query(" UPDATE acsb061 SET score1='$ud_score1',score2='$ud_score2', diff='$ud_diff' WHERE id='$ud_id'");
mysql_close($link);
require 'updatenext.php';
?>
</body>
</html>

[/code]

The second set of code is here - which updates the database -

[code]

<html><head><title></title></head>
<body>
<?
$ud_id=$_POST['ud_id'];
$ud_score1=$_POST['ud_score1'];
$ud_score2=$_POST['ud_score2'];
$ud_diff=$_POST['ud_diff'];
$db = "tourname_Tour";
$link = mysql_connect("localhost","tourname","tmrcdrdlr");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());

mysql_query(" UPDATE acsb061 SET team1='$ud_team1' ,team2='$ud_team2',score1='$ud_score1',score2='$ud_score2', diff='$ud_diff' WHERE id='$ud_id'");
mysql_close($link);
require 'updatefirst.php';
?>
</body>
</html>

[/code]

Ok - so here is my question. Right now, I am having to enter the $diff in the html form - how would I write it so that the $diff in code set 1 above would be calculated?

I would just enter the two scores and the $diff field (which is score1 - score2) would automatically be calculated and then passed through to the updatenext.php file -

Thanks for the help -
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.