Reward on level c++ help

Hello all /emoticons/default_smile.png

I would like to request help with this script i’v come across, Which is fairly simple to understand and edit.

Here is example:

#include “ScriptMgr.h”

class custom_CongratsOnLevel : public PlayerScript
{
public:
custom_CongratsOnLevel() : PlayerScript(“custom_CongratsOnLevel”) { }

void OnLevelChanged(Player* player, uint8 newLevel)
{
    uint32 money, item 

    switch(++newLevel)
    {
        case 10: 
			money = 10;
			item = 4245;

	break;
        case 20: 
			money = 20;
			item = 10050;
	

	break;
        case 30: 
	money = 40; 
	item = 14064;
	
	break;
        case 40: 
	money = 80; 
	item = 21843;
	
	break;
        case 50: 
	money = 100; 
	item = 21843;

	break;
        case 60: 
	money = 150; 
	item = 21843;
	
	break;
        case 70: 
	money = 200; 
	item = 41599;

	break;
        case 80: 
	money = 500; 
	item = 41599;

	break;
        default: 
	return;
    }

    std::ostringstream ss;
   ss << "|cffFF0000[Example Server]|r Congrats to "    << player->GetName() << " on reaching level " << (uint32)  newLevel == 80;
    sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());

    std::ostringstream ss2;
    ss2 << "You have recieved " << money << " gold and " << item <<; //edit this
    player->GetSession()->SendMessage(ss2.str().c_str());

    player->ModifyMoney(money*GOLD); //
player->AddItem(item, 1);          //
 
}

};

void AddSC_custom_CongratsOnLevel()
{
new custom_CongratsOnLevel();
}

Now as you can see, the problem with it is that every time i want to change how much gold or what item to give, I have to edit and rebuild.

for my request i would like someone to help me call the “level”, “gold” and “item” from the database.

Here is an example:

http://i.imgur.com/GBsflab.jpg?1

Help would be much appreciated /emoticons/default_smile.png

Also, How would i turn this into a timed “event” /emoticons/default_ph34r.png

I suggest you to reuse mail_loot_template.