login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Waarom geen berekening? (Opgelost)

Offline Gezienus - 28/05/2010 16:36 (laatste wijziging 28/05/2010 16:38)
Avatar van GezienusLid Ik probeer data uit twee tabellen te vergelijken een als ze gelijk zijn moet er een berekening plaats vinden.
  1. $sql_bm = mysql_query("SELECT * FROM tbl_user");
  2. while ($row_bm = mysql_fetch_array($sql_bm))
  3. {
  4. $user_id = $row_bm['user_id'];
  5. $bonusland = $row_bm['bonus_land_id'];
  6. $malusland = $row_bm['malus_land_id'];
  7. $punten_bonus = 0;
  8. $punten_malus = 0;
  9. $sql_bm_wed = mysql_query("SELECT * FROM tbl_wedstrijd");
  10. while ($row_bm_wed = mysql_fetch_array($sql_bm_wed))
  11. {
  12. $thuisploeg_id = $row_wed['thuisploeg_id'];
  13. $uitploeg_id = $row_wed['uitploeg_id'];
  14. $thuis_doelp = $row_wed['uitslag_thuis'];
  15. $uit_doelp = $row_wed['uitslag_uit'];
  16. if ($thuisploeg_id == $bonusland OR $uitploeg_id == $bonusland)
  17. {
  18. $punten_bonus = $punten_bonus + (($thuis_doelp + $uit_doelp) * 2);
  19. }
  20. if ($thuisploeg_id == $malusland OR $uitploeg_id == $malusland)
  21. {
  22. $punten_malus = $punten_malus + (($thuis_doelp + $uit_doelp) * -2);
  23. }
  24. $result = mysql_query("UPDATE tbl_user SET punten_bonus_land = '$punten_bonus', punten_malus_land = '$punten_malus' WHERE user_id = '$user_id'");
  25. }
  26. }


Hij rekent niets uit en update dus ook niets in de tabel 'user'.
Doe ik hier iets niet niet juist?

2 antwoorden

Gesponsorde links
Offline valles10 - 28/05/2010 16:45 (laatste wijziging 28/05/2010 16:45)
Avatar van valles10 HTML interesse ehm verander OR in de ifjes eens in ||
en plaats
  1. <?php error_reporting(E_ALL); ?>
in je file vanboven
Offline Gezienus - 28/05/2010 16:55 (laatste wijziging 28/05/2010 18:10)
Avatar van Gezienus Lid opgelost. Klein foutje in de query.

  1. $thuisploeg_id = $row_wed['thuisploeg_id'];
  2. $uitploeg_id = $row_wed['uitploeg_id'];
  3. $thuis_doelp = $row_wed['uitslag_thuis'];
  4. $uit_doelp = $row_wed['uitslag_uit'];


moest natuurlijk zijn:

  1. $thuisploeg_id = $row_bm_wed['thuisploeg_id'];
  2. $uitploeg_id = $row_bm_wed['uitploeg_id'];
  3. $thuis_doelp = $row_bm_wed['uitslag_thuis'];
  4. $uit_doelp = $row_bm_wed['uitslag_uit'];

Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.203s