Q:

How to cleverly stop "while loop" in PHP?

I'm having trouble with creating code that echoes a bunch of stuff that is corresponding to the mysql database row.  It needs to keep creating the content until all rows are used and then stop. 
The amount of rows currently present is 5
But for some reason the php file causes the browser to keep loading (it never ends).
Any help would be appreciated! Thanks!
The problem was not in this PHP file but in my HTML code, thanks everybody for helping
<?php 

mysql_connect ("localhost", "root", "") or die ("We couldn't connect!");
mysql_select_db ("dr");
mysql_query ("SELECT * FROM songs");
$result = mysql_query ("SELECT * FROM songs");

while ($row=mysql_fetch_array($result)) {

    $name = $row ['songname'];
    $genres = $row ['songgenres'];
    $mediafire = $row ['mediafirelink'];
    $dropbox = $row ['dropboxlink'];
    $source = $row ['audiosource'];

    echo "
    <div class='playing'>
            <!-- ======== Song Name ======== -->
                <li class='songnameli' id='$source'>
                    <span class='info'>$name</span>
                    <audio>
                        <source src='music/singles/$source.mp3'>
                        <source src='music/singles/$source.ogg'>
                    </audio>
                </li>

            <!-- ======== Playlist ======== -->
                <li class='playlistli'>
                    <img src='icons/addtoplaylist.png' title='Add tot the playlist!' />
                </li>

            <!-- ======== Genres ======== -->
                <li class='genresli'>
                    <img src='icons/genres.png' title='Related genres' />
                    <span class='addedtext genres'>$genres</span>
                </li>

            <!-- ======== Social Media links ======== -->
                <li>
                    <span>
                    <img src='icons/share.png' alt='Share this with your friends!' title='Share this!'>
                    <!-- /// facebook /// -->
                        <a href='http://www.facebook.com/sharer.php?u=http://www.declassified-recordings.com'
                           class='addedtext nlink'
                           target='blank_'
                           onclick='popup (this.href, 800, 500); return false'>Facebook
                        </a>

                    <span>/</span>

                    <!-- /// Twitter /// -->
                        <a href='http://twitter.com/share?
                            text=Thank%20you%20For%20Sharing!%20It%20means%20the%20world%20to%20us!%40Declassifi3d%20
                            &url=http://www.declassified-recordings.com'
                           class='twitterlink nlink'
                           target='blank_'
                           onclick='popup (this.href, 800, 500); return false'>Twitter</a>

                    </span>

                </li>

            <!-- ======== Download links ======== -->

                <li>
                    <img src='icons/download.png' title='Download!'  />
                    <span>
                        <!-- /// Mediafire /// -->
                            <a href='$mediafire'
                               class='addedtext nlink'
                               target='_blank'>Mediafire</a>

                        <span class='genres'>/</span>

                        <!-- /// Dropbox /// -->
                            <a href='$mediafire'
                               class='twitterlink nlink'
                               target='_blank'>Dropbox</a>

                    </span>
                </li>
    </div>";
}
mysql_close ();
?>

A:

First, why do you have these two mysql_query commands right on top of each other like this:
mysql_query ("SELECT * FROM songs");
$result = mysql_query ("SELECT * FROM songs");

Just get rid of that first one & maybe set the actual SQL into variable like this:
$query_sql = "SELECT * FROM songs";
$result = mysql_query ($query_sql);

But specific to the question, change your MySQL query from this:
"SELECT * FROM songs"

To use LIMIT as part of your SELECT:

The LIMIT clause can be used to constrain the number of rows returned
  by the SELECT statement. LIMIT takes one or two numeric arguments,
  which must both be nonnegative integer constants (except when using
  prepared statements).

For example, like this:
"SELECT * FROM songs LIMIT 0,50"

Then you can code some logic to handle pagination such as this:
$start = 0;
$how_many = 50;
$query_sql = "SELECT * FROM songs LIMIT $start, $how_many";
$result = mysql_query ($query_sql);

