std::string name = "blah"
Database_Result res = this->world->db.Query("SELECT `account` FROM `characters` WHERE `name` = '$'", name.c_str());
std::string account = GetRow<std::string>(row, "account");
this->world->db.Query("DELETE FROM `characters` WHERE `account` = '$'", account.c_str());
this->world->db.Query("DELETE FROM `accounts` WHERE `username` = '$'", account.c_str());
Also, you might want to kick the player off if they're online before this happens so they dont end up logging off later and having the character saved back to the database with no account linked to it anymore.
I would put this above the code as well:
Character * victim = 0;
UTIL_FOREACH(this->world->characters, character)
{
if(character->name = name)
victim = character;
}
if(victim) this->world->Kick(0, victim, false);