PHP - Probleme d'eciture

Résolu
Utilisateur anonyme -  
servabat Messages postés 1881 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Voici mon probleme :

Si la variable $row_AD['FILESIZE'] (donc $taille) est superieur a 1000, elle m'affiche , par exemple, 4300 Go au lieu de 4.3 Go .
Sinon si la taille est inferieur à 1000, tout se passe bien.

Comment y remedier ?


voici mon bout de code :

<?php
//////////////////////////////////////////////
// calcul des tailles de disque : CD ou DVD //
//////////////////////////////////////////////
$taille="";
$taille=$row_AD['FILESIZE'];
?>

<?php if ($taille >= 1000) { ?>

$taille=($row_AD['FILESIZE']/1000);
<td><strong><?php echo $taille; ?></strong> Go</td>
<?php } ?>


else


<?php if ($taille < 1000) { ?>
$taille=($row_AD['FILESIZE']*1000);
<td><strong><?php echo $taille; ?></strong> Mo</td>
<?php } ?>
A voir également:

1 réponse

servabat Messages postés 1881 Date d'inscription   Statut Membre Dernière intervention   269
 
peut etre en divisant la taille par 1000 comme ceci :
<?php
//////////////////////////////////////////////
// calcul des tailles de disque : CD ou DVD //
//////////////////////////////////////////////
$taille="";
$taille=$row_AD['FILESIZE'];
$taillego= ($row_AD['FILESIZE'] / 1000);
$taillemo= ($row_AD['FILESIZE'] * 1000);
?>

<?php if ($taille >= 1000) { ?>
<td><strong><?php echo $taillego; ?></strong> Go</td>
<?php } ?>

else

<?php if ($taille < 1000) { ?>
<td><strong><?php echo $taillemo; ?></strong> Mo</td>
<?php } ?>
0