Jump to content

michelt

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

michelt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Nope, that does not solve the problem :/
  2. I am trying to output only 40 of the latest files uploaded on the database server. But when I am trying to see the files uploaded on the server I am getting this error: Warning: round() expects parameter 2 to be long, string given in C:\wamp\www\mshare\lista.php on line 8 Call Stack The code: <?php function bytestostring($size, $precision = 0) { $sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'kB', 'B'); $total = count($sizes); while($total-- && $size > 1024) $size /= 1024; return round($size, $precision)." ".$sizes[$total]; } echo '<div class="header">40 last uploaded files:</div>'; $sql = "SELECT * FROM filer order by id desc limit 40"; $q = mysql_query($sql); echo '<table style="width: 100%;">'; while ($r = mysql_fetch_array($q)) { $i++; $id = $r['id']; $filnamn = $r['name']; $filtyp = explode("/", $r['type']); $filtyp = ucwords($filtyp[0]); if($filtyp == "") { $filtyp = "Unkown"; } $filstorlek = bytestostring($r['size'], ""); $a = $i%2; echo'<tr><td class="lista">'; echo ''.$i.'. <td class="lista">'.$filnamn.'<td class="lista">'.$filtyp.' <td class="lista">'.$filstorlek.' <td class="lista"><a href="download.php?id='.$id.'"'.$a.'"><img src="download-icon.jpg" class="imagedow"></a>'; } echo "</table>"; ?> I am new to PHP coding so you guys just know.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.