This forum has been archived. All content is frozen. Please use KDE Discuss instead.

A small php script that I wrote

Tags: None
(comma "," separated)
Reuben Perelman
Registered Member
Posts
10
Karma
0

A small php script that I wrote

Sat Jul 15, 2006 2:26 pm
Displays basic statistics about you music collect from amarok's mysql database.

My music collection statistics.

Code: Select all
<?
$db = mysqli_connect("host","username","password","db") OR die("My computer is down or not running mysql.");

$query = mysqli_query($db,"SELECT COUNT(*),SUM(filesize),AVG(bitrate) FROM tags;");
$row = mysqli_fetch_array($query);

$song_count = $row[0];
$song_size  = round(($row[1] / (1024 * 1024 * 1024)), 1);
$song_avg   = round($row[2],0);
unset($row,$query);


?>
<html>
  <head>
    <title>
       Amarok Statistics
    </title>
  </head>
  <body>
    <?=$song_count?> songs with an average bitrate of <?=$song_avg?>kbps are taking up <?=$song_size?>GB of space.
  </body>
</html>


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]