×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Mysql mp3: Difference between revisions

    Content added Content deleted
    imported>mutante
    mNo edit summary
    imported>mutante
    mNo edit summary
     
    (2 intermediate revisions by one other user not shown)
    Line 1: Line 1:
    <pre>
    #REDIRECT [[HowTo/MakeYourOwnMp3Database]]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>
    Min Musik databas
    </title>
    <style type="text/css">
    <!--
    body {
    background-color: #332255;
    color: #aaaa00;
    }
    table {
    width:100%;
    empty-cells: show;
    }
    td { border:1px solid #000; vertical-align:top; overflow:hidden; white-space: nowrap;}
    th { border:2px solid #000; vertical-align:top; overflow:hidden; }
    input {
    background-color: #000000;
    color: #00aa00;
    }
    select {
    background-color: #000000;
    color: #00aa00;
    }

    -->
    </style>
    </head>
    <body>
    <table>
    <tr><th colspan="3">my musik databas v0.23</th></tr>
    <tr><td colspan="3">
    <?php
    echo "My name is Sirius.</td></tr><tr><td colspan=\"3\">Hello, fnord from ".$_SERVER['REMOTE_ADDR'].", you are using ".$_SERVER['HTTP_USER_AGENT']."</td></tr>";
    echo "<tr><td colspan=\"3\">My IP / hostname is: ".$_SERVER['TRANUILA']."</td></tr>";
    ?>
    <tr><td colspan="3">
    <form action="index.php" method="post">
    <p>
    search for:
    <input type="text" id="what" name="what" size="23" />
    in
    <select name="where" id="where">
    <option value="filename">filename</option>
    <option value="artist">artist</option>
    <option value="title">title</option>
    <option value="album">album</option>
    <option value="comment">comment</option>
    <option value="year">year</option>
    <option value="genre">genre</option>
    <option value="path">path</option>
    <option value="copyright">copyright</option>
    <option value="stereo">stereo</option>
    <option value="frequency">frequency</option>
    </select>
    <input type="submit" value="Go" />
    </p>
    </form>
    </td></tr>
    <tr><td colspan="3">
    <?php

    $db="musik";
    $link = mysql_connect("localhost","hitchcook","map9brkl");
    # no, this is not my real pass :)

    if (! $link)
    die("Couldn't connect to MySQL");
    mysql_select_db($db , $link)
    or die("Couldn't open $db: ".mysql_error());

    if (isset($_POST["what"])) {
    $what = $_POST["what"];
    } else {
    $what="fnord";
    }
    if (isset($_POST["where"])) {
    $where = $_POST["where"];
    } else {
    $where="filename";
    }

    $result=mysql_query( "SELECT * FROM musik where $where LIKE '%$what%'" );

    $num=mysql_num_rows($result);

    echo "Searched for <b>$what</b> in <b>$where</b>. $num files found.</td></tr>";

    echo "<tr><th></th></tr><tr><th>id</th><th>filename</th><th>artist</th><th>title</th><th>album</th><th>comment</th><th>track</th><th>year</th><th>genre</th><th>path</th><th>filesize</th><th>copyright</th><th>layer</th><th>stereo</th><th>goodframes</th><th>badframes</th><th>frequency</th><th>playtime</th></tr>";

    while($row = mysql_fetch_array($result)) {
    echo "<tr><td>".$row["id"]."</td><td>".$row["filename"]."</td><td>".$row["artist"]."</td><td>".$row["title"]."</td><td>".$row["album"]."</td><td>".$row["comment"]."</td><td>".$row["track"]."</td><td>".$row["year"]."</td><td>".$row["genre"]."</td><td>".$row["path"]."</td><td>".$row["filesize"]."</td><td>".$row["copyright"]."</td><td>".$row["layer"]."</td><td>".$row["stereo"]."</td><td>".$row["goodframes"]."</td><td>".$row["badframes"]."</td><td>".$row["frequency"]."</td><td>".$row["playtime"]." s</td></tr>";
    }
    echo "</table>";
    mysql_close();


    ?>
    </body>
    </html>
    </pre>

    Latest revision as of 12:20, 30 June 2006

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>
    Min Musik databas
    </title>
    <style type="text/css">
    <!--
    body {
    background-color: #332255;
    color: #aaaa00;
    }
    table {
    width:100%;
    empty-cells: show;
    }
    td { border:1px solid #000; vertical-align:top; overflow:hidden; white-space: nowrap;}
    th { border:2px solid #000; vertical-align:top; overflow:hidden; }
    input {
    background-color: #000000;
    color: #00aa00;
    }
    select {
    background-color: #000000;
    color: #00aa00;
    }
    
    -->
    </style>
    </head>
    <body>
    <table>
    <tr><th colspan="3">my musik databas v0.23</th></tr>
    <tr><td colspan="3">
    <?php
    echo "My name is Sirius.</td></tr><tr><td colspan=\"3\">Hello, fnord from ".$_SERVER['REMOTE_ADDR'].", you are using ".$_SERVER['HTTP_USER_AGENT']."</td></tr>";
    echo "<tr><td colspan=\"3\">My IP / hostname is: ".$_SERVER['TRANUILA']."</td></tr>";
    ?>
    <tr><td colspan="3">
    <form action="index.php" method="post">
    <p>
    search for:
    <input type="text" id="what" name="what" size="23" />
    in
    <select name="where" id="where">
    <option value="filename">filename</option>
    <option value="artist">artist</option>
    <option value="title">title</option>
    <option value="album">album</option>
    <option value="comment">comment</option>
    <option value="year">year</option>
    <option value="genre">genre</option>
    <option value="path">path</option>
    <option value="copyright">copyright</option>
    <option value="stereo">stereo</option>
    <option value="frequency">frequency</option>
    </select>
    <input type="submit" value="Go" />
    </p>
    </form>
    </td></tr>
    <tr><td colspan="3">
    <?php
    
    $db="musik";
    $link = mysql_connect("localhost","hitchcook","map9brkl");
    # no, this is not my real pass :)
    
    if (! $link)
    die("Couldn't connect to MySQL");
    mysql_select_db($db , $link)
    or die("Couldn't open $db: ".mysql_error());
    
    if (isset($_POST["what"])) {
    $what = $_POST["what"];
    } else {
    $what="fnord";
    }
    if (isset($_POST["where"])) {
    $where = $_POST["where"];
    } else {
    $where="filename";
    }
    
    $result=mysql_query( "SELECT * FROM musik where $where LIKE '%$what%'" );
    
    $num=mysql_num_rows($result);
    
    echo "Searched for <b>$what</b> in <b>$where</b>. $num files found.</td></tr>";
    
    echo "<tr><th></th></tr><tr><th>id</th><th>filename</th><th>artist</th><th>title</th><th>album</th><th>comment</th><th>track</th><th>year</th><th>genre</th><th>path</th><th>filesize</th><th>copyright</th><th>layer</th><th>stereo</th><th>goodframes</th><th>badframes</th><th>frequency</th><th>playtime</th></tr>";
    
    while($row = mysql_fetch_array($result)) {
      echo "<tr><td>".$row["id"]."</td><td>".$row["filename"]."</td><td>".$row["artist"]."</td><td>".$row["title"]."</td><td>".$row["album"]."</td><td>".$row["comment"]."</td><td>".$row["track"]."</td><td>".$row["year"]."</td><td>".$row["genre"]."</td><td>".$row["path"]."</td><td>".$row["filesize"]."</td><td>".$row["copyright"]."</td><td>".$row["layer"]."</td><td>".$row["stereo"]."</td><td>".$row["goodframes"]."</td><td>".$row["badframes"]."</td><td>".$row["frequency"]."</td><td>".$row["playtime"]." s</td></tr>";
      }
    echo "</table>";
    mysql_close();
    
    
    ?>
    </body>
    </html>
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.