In this code:

$Sql = "select * from $TableName where ID=What? ";

I want to go to last record that it's ID=last ID in the table.