Jump to content


Photo

Update Results


  • Please log in to reply
3 replies to this topic

#1 ElyTTL

ElyTTL
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 September 2006 - 04:48 PM

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:
  • Played
  • Won
  • Drawn
  • Lost
  • Games For
  • Games Against

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

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 12 September 2006 - 04:54 PM

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.


Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 ElyTTL

ElyTTL
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 September 2006 - 04:59 PM

Thank you, the code i have is this:

<!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>/
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

EDITED BY WILDTEEN88: PLEASE USE CODE TAGS ([CODE][/CODE]) WHEN POSTING CODE

#4 ElyTTL

ElyTTL
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 September 2006 - 03:26 PM

*bump* please help if you can




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users