All records not getting displayed in MySQL Database

Hi,

I am trying arrange records, which contain the first letters of a group of companies, from my database in columns, and this is my SQL query:

mysql_select_db($database_directory, $directory);
$query_mda = "SELECT DISTINCT mdal FROM mda ORDER BY mdal ASC";
$mda = mysql_query($query_mda, $directory) or die(mysql_error());
$row_mda = mysql_fetch_assoc($mda);
$totalRows_mda = mysql_num_rows($mda);

This is my PHP code for arranging the records:

<?php
$cols = 10;
$count = 0;
echo("<table align=\\"center\\"><tr>");
while($row_mda = mysql_fetch_array($mda)) {
    if($count % $cols == 0)
        echo("</tr><tr>");
    echo ("<td align=\\"center\\">"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;"."<a href=\\"list.php?mdal=".$row_mda['mdal']."\\" class=\\"listTextA\\">".$row_mda['mdal']."</a>"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;");	
echo("</td>");
$count++;

}
echo("</tr></table>");
?>

The problem I am encountering is that it displays all the records except the first record. Please what am I doing wrong?

this …

$row_mda = mysql_fetch_assoc($mda);

is getting the first record, thereby causing the pointer to move to the 2nd record.

Either delete that line or reset the pointer prior to your WHILE loop
http://php.net/manual/en/function.mysql-data-seek.php

Deleting $row_mda = mysql_fetch_assoc($mda); worked fine…thanks.