First of all, am I honestly the only one who does not see the point of this script? If they're admins or regular GMs they can add the items anyway. If you change it to a donation rank you're going to need to add some filters because you don't want donaters running around with 2 martin furies or something.
Secondly, you can easily merge the two date/time columns together by allowing the mysql server itself to fill the data. (Although it's more of a cosmetic thing than anything)
Thirdly, you're wasting performance by calling
Code:
local PlayerName = player:GetName()
local AccountName = player:GetAccountName()
local Rank = player:GetGmRank()
before checking whether the query returned something. You're not going to be using those values if the query didn't return anything thus you could've been saving memory and cpu.
Fourthly, work on your indentation, although it is still part of your personal style of writing keep it consistent! Yours is all over the place.
Fifthly, no need for additional concatenation on
Code:
"SELECT * FROM items WHERE entry = "..code..""
Anyway, I'm not trying to sound like an ass and sorry if I do, but it seems like nowadays people get rewarded for being ignorant. I would have forgiven some of your mistakes if you were new to Lua - but you're not and I think I recall seeing some of the made mistakes before. Fix some of the points above and you'll have my rep.