• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

MyAcc how to add new table to character information?

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, how to add new information in "Character Information" i add under "Sex" in characters.php new code and in characters.html.twig but i still dont see anything new
 
Solution
Still not work :( I was trying with ID too but same error

View attachment 51079

You need to fetch the query, like this:

PHP:
$mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `id` = ' . $player->getId() . ' LIMIT 1')->fetchColumn();

Then you need to pass variable to Twig, here:
PHP:
$twig->display('characters.html.twig', array(
   'outfit' => isset($outfit) ? $outfit : null,
   'player' => $player,
   'account' => $account,
   'flag' => $flag,
   'oldName' => $oldName,
   'sex' => $player_sex,
   'marriage_enabled' => $config['characters']['marriage_info'] && $db->hasColumn('players', 'marriage'),
   'marital_status' => $marital_status,
   'vocation' => $player->getVocationName(),
   'frags_enabled' => $frags_enabled...
Clear cache in Admin Panel:
1603511425780.png

Or change in config.local.php (for local development):
Code:
$config['env'] = 'dev'; // dev or prod
 
Clear cache in Admin Panel:

Or change in config.local.php (for local development):
Code:
$config['env'] = 'dev'; // dev or prod


Work thanks! I have one more quesiton for you, i try show how many upgrades user have in column "mrupka" from "players" but it not work ;/


Code:
    $mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `name` = ' . $player->getName() . ' LIMIT 1');
Maybe u know why? ;p
 
Work thanks! I have one more quesiton for you, i try show how many upgrades user have in column "mrupka" from "players" but it not work ;/


Code:
    $mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `name` = ' . $player->getName() . ' LIMIT 1');
Maybe u know why? ;p
Try using player id instead of name, but if you want to use name you're missing the quotes, the following query should work:
PHP:
 $mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `name` = "' . $player->getName() . '" LIMIT 1');
 
Try using player id instead of name, but if you want to use name you're missing the quotes, the following query should work:
PHP:
 $mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `name` = "' . $player->getName() . '" LIMIT 1');

Still not work :( I was trying with ID too but same error

1603542525116.png
 
Still not work :( I was trying with ID too but same error

View attachment 51079

You need to fetch the query, like this:

PHP:
$mrupka = $db->query('SELECT `mrupka` FROM `players` WHERE `id` = ' . $player->getId() . ' LIMIT 1')->fetchColumn();

Then you need to pass variable to Twig, here:
PHP:
$twig->display('characters.html.twig', array(
   'outfit' => isset($outfit) ? $outfit : null,
   'player' => $player,
   'account' => $account,
   'flag' => $flag,
   'oldName' => $oldName,
   'sex' => $player_sex,
   'marriage_enabled' => $config['characters']['marriage_info'] && $db->hasColumn('players', 'marriage'),
   'marital_status' => $marital_status,
   'vocation' => $player->getVocationName(),
   'frags_enabled' => $frags_enabled,
   'frags_count' => $frags_count,
   'town' => isset($config['towns'][$player->getTownId()]) ? $config['towns'][$player->getTownId()] : null,
   'house' => array(
      'found' => isset($house['id']),
      'add' => isset($house['id']) ? $add : null,
      'name' => isset($house['id']) ? (isset($house['name']) ? $house['name'] : $house['id']) : null,
      'town' => isset($house['town']) ? ' (' . $config['towns'][$house['town']] . ')' : ''
   ),
   'guild' => array(
      'rank' => isset($guild_name) ? $rank_of_player->getName() : null,
      'link' => isset($guild_name) ? getGuildLink($guild_name) : null
   ),
   'comment' => !empty($comment) ? wordwrap(nl2br($comment), 60, "<br/>", true) : null,
   'skills' => isset($skills) ? $skills : null,
   'quests_enabled' => $quests_enabled,
   'quests' => isset($quests) ? $quests : null,
   'equipment' => isset($equipment) ? $equipment : null,
   'skull' => $player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? $skulls[$player->getSkull()] : null,
   'deaths' => $deaths,
   'frags' => $frags,
   'signature_url' => isset($signature_url) ? $signature_url : null,
   'player_link' => getPlayerLink($player->getName(), false),
   'hidden' => $hidden,
   'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null,
   'characters_link' => getLink('characters'),
   'account_players' => isset($account_players) ? $account_players : null,
   'search_form' => generate_search_form(),
   'canEdit' => hasFlag(FLAG_CONTENT_PLAYERS) || superAdmin()
));

You need to add:
PHP:
'mrupka' => $mrupka,

somewhere in the array.
 
Solution
Back
Top