I have this script, which I am trying to have automatically update the database. Right now it seems only to update 1 record, instead of looping through and calculating all, then updating them all in the database.
<?
require ( "xxxxxxxxxxxxxxxx.php" );
$games_rs = $conn->Execute ( "SELECT * FROM soccer_games ORDER BY game_date DESC" ) or die ( $conn->ErrorMsg() );
$games1_rs = $conn->Execute ( "SELECT * FROM soccer_games ORDER BY game_date DESC" ) or die ( $conn->ErrorMsg() );
?>
<? while ( ! $games_rs->EOF ) {
$new_rating2 = $games_rs->Fields("team_rating") + $games1_rs->Fields("team_rating");
?>
<?
$sql = "UPDATE soccer_ratings SET team_rating = '$new_rating2', team_prevrating = '$team_rating1' WHERE team_id = '$team_rated'";
$add_rating_rs = $conn->Execute($sql) or die ( $conn->ErrorMsg() );
?>
<? $games_rs->MoveNext(); } ?>
For some reason it is only insert the first row into the database, instead of looping through and calculating each rating, from each game.