PHP - Probleme d'eciture
Résolu
Utilisateur anonyme
-
servabat Messages postés 1881 Date d'inscription Statut Membre Dernière intervention -
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 } ?>
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:
- PHP - Probleme d'eciture
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Retour à la ligne php ✓ - Forum PHP
- Alert php - Forum PHP
- Retour a la ligne php ✓ - Forum PHP
1 réponse
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 } ?>
<?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 } ?>