> 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;

So $t01 is PRINTed correctly but is incorrect in the database?  Check
mysql_affected_rows() after the query is run to see if any changes were made
to the databse.  The only potential problems I see off the top of my head
are the single quotes around $t01 and $voorspelling in the query.  If either
of those are numeric values, then you must omit the single quotes.  Hope
this helps...


-- 
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]

Reply via email to