Re: Problem with updating
| From: | Chris Hayes | Date: | Wed, 15 Aug 2001 23:08:35 +0000 |
| Subject: | Re: Problem with updating | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62915@lists.php.net to get a copy of this message | ||
hi martin,
Could you send the code again and now include
- the part where you get the $id_voorspelling from
- the part where you make the $t1
- which variable goes wrong? $t1 or $t01?
Can you check the table in mysql to see whether the error is in the update
or in the print?
Chris
Van: "Martin Kampherbeek" <m.kampherbeek@home.nl>
Aan: <php-general@lists.php.net>
Datum verz. Wed, 15 Aug 2001 21:28:15 +0200
Onderwerp: [PHP] Problem with updating
> Hello,
>
> I have created a predictionscompetition and some code counts te total score of a match of a
> person.
> On the screen it workes, but in de database it goes wrong. Each person gets the total of the
> last person. There must be something wrong with the update statement.
> I hope someone can help me.
>
> Cheers,
> Martin.
>
> $number = MYSQL_NUMROWS($result);
> $i = 0;
> WHILE ($i < $number):
> $naam = mysql_result($result,$i,"naam");
> $uit_gr = mysql_result($result,$i,"uit_gr");
> $uit_te = mysql_result($result,$i,"uit_te");
> $ru_gr = mysql_result($result,$i,"ru_gr");
> $ru_te = mysql_result($result,$i,"ru_te");
> $minuut = mysql_result($result,$i,"minuut");
> $toto = mysql_result($result,$i,"toto");
>
> /* Count everything*/
>
> $t01 = $u1+$r1+$b1+$m1+$t1;
> $sqlb = "UPDATE voorspelling1 SET totaal='$t01' WHERE id_voorspelling =
> '$id_voorspelling'";
> $resultb = mysql_query($sqlb);
> PRINT "$naam $uit_gr $uit_te $u1 $r1 $b1 $m1 $t1 $t01<BR>";
> PRINT "$t1<BR>";
> $i++;
> ENDWHILE;
>
--------------------------------------------------------------------
-- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands --
--------------------------------------------------------------------