Instead of use getcharid(0, $kill$), you just need to use $kill$ ($kill$ is actually saving the character id (char_id) and not the character name (name), so you don't need to use getcharid).
Try this:
OnClock0000:
set .prize, 7227;
set .amount, 5;
query_sql "SELECT `char_id` FROM `char_reg_num` ORDER BY `key` = 'kills' DESC LIMIT 1", $kill$;
query_sql "SELECT `name` FROM `char` WHERE `char_id`="+$kill$+"",
[email protected]$;
if (!isloggedin(getcharid(3,
[email protected]$))
query_sql "INSERT INTO `inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify` ) VALUES ('"+$kill$+"', '"+.prize+"', '" +.amount+ "', 0, 1)";
else
getitem .prize, .amount, getcharid(3,
[email protected]$);
end;