Thanks Peter The reason I was wanting to do it in php was because the sql query is quite complex and variable depending on the input from a form. When the result page is presented I want to provide a link to the last record at the top of the page. After connecting and selecting the table I am constructing the query I then want pick off the last record and then get all the records the rather cludgy way I am doing it is this: First run $result = mysql_query($sqlstr." desc limit 0,1"); $row = mysql_fetch_assoc($result); Second run $result = mysql_query($sqlstr); while ($row = mysql_fetch_assoc($result)) { This is fine while there is only one order by appended to the query but if there is none or more than one it doesn't work so well Thanks Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php