Question: I have this code working 100%, but it doesn't show the latest details required from the MySQL database.

```
$SQL = "SELECT * FROM wdclients ORDER BY 'id' DESC LIMIT 6";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
    echo $latest1;
    print $db_field['clientid'];
    echo $latest2;
    print $db_field['cname'];
    echo $latest3;
    print $db_field['cname'];
    echo $latest4;
}

```

The problem now is that I require the code to show only the 6 latest entries in the database. I have over 500 clients in the database but it only shows the first 6 and never update.

The "ID" field in database has set the auto-increment value.

Answer: 
Although it usually does the trick, sorting by id is no guarantee to get the latest data entered. You'd better add a `DATETIME` field like date\_created or date\_updated that contains a timestamp when the record was either inserted or last updated, depending on your wishes. That way you'll be sure to get the data in proper chronological order.
It's because you have put id in regular single quotes. You have to use backquotes in order for MySQL to parse it into a value:

```
$SQL = "SELECT * FROM wdclients ORDER BY `id` DESC LIMIT 6";

```