Re: [PHP] Problem with updating

2001-08-15 Thread Chris Hayes

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" <[EMAIL PROTECTED]>
Aan:<[EMAIL PROTECTED]>
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";
>   PRINT "$t1";
>   $i++;
>  ENDWHILE;
> 




--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --


 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problem with updating

2001-08-15 Thread Martin Kampherbeek

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";
  PRINT "$t1";
  $i++;
 ENDWHILE;