Hi,

I'm not sure if the following is a MySQL or PHP issue but would appreciate all advice.

I have a page where a list of names are to be displayed. I present the user the option of choosing the sort order using links of the letters A-Z but also the option to show all names on the same page.

I thought it was working fine but have just realised that in each case the very first record is missing from any choice. So, for example if the user clicks "A" the first name displayed should be Adami, Valerio followed by Adela, R.D. etc. In fact the first name is skipped and all names from the second onwards print fine. This happens with all choices A-Z and with the show all option (in this case Adami is the only record skipped as he is the first).

The page can be viewed here (with code extracts included below):

http://www.circulodelarte.com/produc...lang=es&sort=a

Can anyone can shed any light as to where this error is being caused and how it might be fixed?

Many thanks,

Gary Crighton

CODE EXTRACTS:

My sort links takes the following form:

<a href="<?PHP $PHP_SELF ?>?lang=<?PHP echo $lang ?>&sort=a">A</a>


My select statement:

if ($sort == "all") {
$result = mysql_query ("SELECT * FROM biografias WHERE Tipo = 1 ORDER BY nombre");
} else {
$result = mysql_query ("SELECT * FROM biografias WHERE Tipo = 1 AND LOWER(SUBSTRING(nombre,1,1)) = '$sort' ORDER BY nombre");
}


Printout statements as follows:

<?
if ($row = mysql_fetch_array($result) == "") {
?>

Etc...

<?
} else {
while ($row = mysql_fetch_array($result)) {
?>

<tr><td class='list'>
<a href='/production/artistas/artistas_detalle.php?lang=<?PHP echo $lang ?>&ID=<?PHP echo $row["ID"]?>'><?PHP echo $row["Nombre"]?></a>
</td></tr>

?>

Etc...