Sorting Data in Table by Column mysql and wordpress

Viewed 40

I am trying to sort the table by scores in ascending order.

Here is the table :

Here is the code I'm using

$sql = "SELECT * FROM scores";
  $myData = mysql_query($sql);

  echo "<table class='table table-hover table-bordered table-striped'>
        <tr>
        <th>Username</th>
        <th>Email</th>
        <th>Score</th>
        </tr>";

  while($record = mysql_fetch_array($myData)) {
        echo "<tr>";
        echo "<td>" . $record['id'] . "</td>";
        echo "<td>" . urldecode($record['email']) . "</td>";
        echo "<td>" . $record['score'] . "</td>";
        echo "</tr>";
   }
   echo "</table>";
?>
<?php
    $str="@";
    echo htmlentities($str);
?>
1 Answers
Related