29-11-2007, 11:11 PM
tu peux simplifier :
[/quote]Code PHP :
<?php
if ( $abatprio1 != 0 )
{
${'p2va'.$prio1.''} = $donnee['p2va'.$prio1.''] ;
$tpsactu = time() ;
$tpsancien = $donnee['tpsconstrstruct'] ;
$ptsconstr = ceil((($pcpopa * 1) / 1000) * ( $tpsactu - $tpsancien)) ;
$difptsattente = ceil(${'p2va'.$prio1.''} - $ptsconstr) ;
$structconstr = floor($difptsattente / ${'point2vie'.$prio1.''}) ;
if ($structconstr >= 1 )
{
mysql_query('UPDATE structure SET '.$prio1.' = '.$prio1.' + '.$structconstr.' where idj="'.$id.'"') OR DIE (mysl_error());
mysql_query('UPDATE structureattente SET a'.$prio1.' = a'.$prio1.' - '.$structconstr.' where idj="'.$id.'"') OR DIE (mysl_error()) ;
}
else{}
mysql_query('UPDATE structpointdevieconstr SET p2va'.$prio1.'="'.$difptsattente.'", tpsconstrstruct ="'.$tpsactu.'" ') OR DIE (mysl_error());
}
mais bon, essaie d'utiliser des tableaux, c'est plus lisible.
A+
Pascal