PHP MYSQL order lists by popularity ← (PHP, MySQL)

one text

Solution:

<div id="right-column-sidebar">
<ol>
<?php
    $link = mysql_connect("localhost", "root", "password");
    mysql_select_db("db", $link);

    $query = "SELECT * FROM table";

    $result = mysql_query($query);

    while ($row = mysql_fetch_array($results)) :
        ?>
        <li> <a href="#"> <?php echo $row['title']; ?> </a></li>
    <?php endwhile; 
?>
</ol>
</div>

This all assumes you have some data inside the database db and inside the table table you have a column called title which contains a bunch of entries with titles. This will loop through the results and display them.

Of course sorting the information just requires some extra info in your query.

Source