Jump to content

Update Results


ElyTTL

Recommended Posts

Hi, i need to know the best/simplest way to update a results table using to the lastest results just posted, such as get the teamA and teamA's points to update the following coloums:
[list]
[*]Played
[*]Won
[*]Drawn
[*]Lost
[*]Games For
[*]Games Against
[/list]

The Results will be published useing the games for such as 0 - 10 then if the points are 6 or higher then this is a win and 5 is a draw and then less than 5 is a loss.

Any help will be welcomed with many thanks.

Ben
Link to comment
Share on other sites

hello ElyTTL, welcome to the forums.

couple of things i'd like to tell you, in order to get you acquanted here.  First off, please do not make threads with ambiguous titles such as "HELP Please". Instead, use a description that reflects your problem at hand.

2nd, this forum is not really here for people laying out your framework for you or writing your code for you.  If you are looking for someone to join your project, or do it for you, then head on over to the freelance forum (and please take the time to read the rules and guidelines for posting there). 

this forum is here for people who write their own scripts, and they might have a bug they can't figure out.  If this is what you are doing, then please, by all means, show us what you've got, and what the problem seems to be.

Link to comment
Share on other sites

Thank you, the code i have is this:

[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
$date = $_REQUEST["date"];
$div = $_REQUEST["div"];
$teama = $_REQUEST["teama"];
$teamapts = $_REQUEST["teamapts"];
$teamb = $_REQUEST["teamb"];
$teambpts = $_REQUEST["teambpts"];
$con = mysql_connect("localhost","elyttl","PASSSWORD");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("elyttl_2168", $con);

mysql_query("INSERT INTO tbl_latres (Date, Divsion, TeamA, TeamA_pts, TeamB, TeamB_pts)
VALUES ('$date', '$div', '$teama', '$teamapts', '$teamb', '$teambpts' )");
echo $date . " " . $div . " " . $teama . " " . $teamapts . " " . $teamb . " ". $teambpts;
mysql_close($con);
$con = mysql_connect("localhost","elyttl","PASSWORD");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("elyttl_2168", $con);
if $div ==1;

$query="SELECT * FROM tbl_div1
WHERE TeamName = $teama";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

$i=0;
while ($i < $num) {

$Played=mysql_result($result,$i,"Played");
$Won=mysql_result($result,$i,"Won");
$Drawn=mysql_result($result,$i,"Drawn");
$Lost=mysql_result($result,$i,"Lost");
$G_for=mysql_result($result,$i,"G_for");
$G_asgt=mysql_result($result,$i,"G_asgt");
$Points=mysql_result($result,$i,"Points");



$i++;

}
$Played = $Played + 1
if ($teamapts > 5)
$Won = $Won + 1;
elseif ($teamapts == 5)
$Drawn = $Drawn + 1;
Else
$Lost = $Lost + 1;
  $G_for = $G_for + $teamapts
$G_agst = $G_agst + $teambpts
$Points = $Points + $teamapts

mysql_query("UPDATE tbl_div1 SET Played = '$Played', SET Won = '$Won', SET Drawn = '$Drawn', SET Lost = '$Lost', SET G_for = '$G_for', SET G_agst = '$G_agst', SET Points = '$Points'
WHERE TeamName = '$teama'");


else

?>
</body>/[/code]
the top part works however the bottom part doesn't, it will probally look like it was written by a complete NooB as it has, but you can only learn, i think that it probally all wrong

[b]EDITED BY WILDTEEN88: PLEASE USE CODE TAGS ([nobbc][CODE][/CODE][/nobbc]) WHEN POSTING CODE[/B]
Link to comment
Share on other sites

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.