<?php
$req3 = "SELECT id,nbrevaisseaux,idjoueur FROM matgraph_espio2 WHERE idespionner = $idlogin AND jour=1 ORDER BY id ASC";
$res3 = db_mysql_Query($req3) or die('Erreur SQL! <br>'.$req3.'<br>'.mysql_error());
$num3 = mysql_num_rows($res3);
if ( $num3 > 0 ) {
  While ( $row3 = mysql_fetch_array($res3) ) {
  
$req = "SELECT id,nbrevaisseaux FROM matgraph_espio2 WHERE idjoueur = $row3[idjoueur] AND idespionner = $idlogin ORDER BY jour DESC limit 1";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$row = mysql_fetch_array($res);
  
$nbrevaisseaux = $row3[nbrevaisseaux] + $i ;
$sql = "UPDATE matgraph_espio2 SET nbrevaisseaux = $nbrevaisseaux WHERE id='$row[id]' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());

}}
?>