per far comprendere meglio incollo l'intera area del codice, affinche possa essere comprensibile per chi di php se ne intende.
<?php
//verifica esistenza pagamento
$sql =" SELECT $db3.$tb3.periodoin AS periodoin , $db3.$tb3.periodoout AS periodoout , $db3.$tb3.instradamento AS instradamento FROM $db3.$tb3 WHERE $db3.$tb3.instradamento = '$inst' ORDER BY periodoin ";
$results = mysql_query($sql,$conection3);
$rows = mysql_fetch_assoc($results);
//$numrows = mysql_num_rows($results);
//if ( mysql_num_rows($result) != 0 ) if($numrows >=1){
// && ( mysql_num_rows($results) != 0 )
//while($rows = mysql_fetch_array($results)){
//if ($gmdin== '$rows[periodoin]' && $gmdout== '$rows[periodoout]' && $inst== '$rows[instradamento]'){
if ( $gmdin == $rows['periodoin'] && $gmdout == $rows['periodoout']) {
}
else
{
//Guadagno mese scorso
$sql =" SELECT $db1.$tb1.calldate AS calldate , $db1.$tb1.dst AS dst, (SUM($db1.$tb1.billsec)/60) AS guadagnoms FROM $db1.$tb1 WHERE $db1.$tb1.dst = '$inst' AND $db1.$tb1.calldate between '$gmdin' and '$gmdout' ";
$results = mysql_query($sql,$conection1);
$rows = mysql_fetch_assoc($results);
$guadagnomsv = $rows[guadagnoms];
if ($guadagnomsv <= $optmin) { $guadagnoms = $rows[guadagnoms]*$opcmin; } elseif ($guadagnomsv > $optmax) { $guadagnoms = $rows[guadagnoms]*$opcmax; } else { $guadagnoms = $rows[guadagnoms]*$opcmed; }
$timestamp = strtotime($gmdin);
$mese = date('m',$timestamp);
/**************** Inizio Traduzione (00 = Mese) *********************/
if($mese == "01") { $mese = "Gennaio"; } if($mese == "02") { $mese = "Febbraio"; } if($mese == "03") { $mese = "Marzo"; } if($mese == "04") { $mese = "Aprile"; } if($mese == "05") { $mese = "Maggio"; } if($mese == "06") { $mese = "Giugno"; } if($mese == "07") { $mese = "Luglio"; } if($mese == "08") { $mese = "Agosto"; } if($mese == "09") { $mese = "Settembre"; } if($mese == "10") { $mese = "Ottobre"; } if($mese == "11") { $mese = "Novembre"; } if($mese == "12") { $mese = "Dicembre"; }
?>
<h2>Richiedi Pagamenti </h2>
<p class="libero">
<table width="70%" border="0">
<tr>
<td>Periodo:</td>
<td><?php echo $mese; ?> <?php echo date("Y"); ?></td>
<td>Accredito:</td>
<td>€ <?php echo round($guadagnoms,2); ?></td>
<td>Terminazione:</td>
<td><?php echo $inst; ?></td>
<td valign="bottom"><form id="form" name="form" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="pag">
<input type="hidden" name="accredito" id="accredito" value="<?php echo round($guadagnoms,2); ?>" />
<input type="hidden" name="periodoin" id="periodoin" value="<?php echo $gmdin; ?>" />
<input type="hidden" name="periodoout" id="periodoout" value="<?php echo $gmdout; ?>" />
<input type="hidden" name="instradamento" id="instradamento" value="<?php echo $inst; ?>" />
<input type="hidden" name="addebito" id="addebito" value="0" />
<input type="hidden" name="stato" id="stato" value="Richiesta in corso" />
<input type="hidden" name="bonus" id="bonus" value="0" />
<input type="submit" name="button" id="button" value="Richiedi pagamento" />
</form>
</td>
</tr>
</table>
</p>
</p>
<?php
}
?>

