here's a simple SQL script that returns the last row created. this is great for when you add a new record that has an autogenerated id and you need that number.
CREATE PROCEDURE [dbo].[getLastLogin] AS SELECT TOP 1 * FROM dbo.login ORDER BY id DESC GO
SELECT * FROM `login` ORDER BY `id` DESC LIMIT 1,1;