Pete Doherty
New Member
- Joined
- Sep 12, 2008
- Messages
- 60
- Reaction score
- 0
Solved. It was the hide_char value that was set to NULL when infact it was needed to be set to 0 or 1.
Thank you Chris!
---------
Ok, this is the original code from the latest Modern AAC. I don't know if any others have this problem, but anyways, it seems that the query doesn't find my characters and hence doesn't load. If I remove "if(!empty($characters))" the title "Characters" appear, thus proving that the injection itself loads. I've made sure my account have plenty of characters but still the "Characters" does not appear when viewing characters.
So my quess is that the query is faulty or perhaps my database. Any ideas?
I have also tried this code without success.
Code:
UPDATE players SET hide_char = 0 WHERE hide_char IS NULL;
Code:
ALTER TABLE players MODIFY hide_char INT(11) DEFAULT 0;
Thank you Chris!
---------
Ok, this is the original code from the latest Modern AAC. I don't know if any others have this problem, but anyways, it seems that the query doesn't find my characters and hence doesn't load. If I remove "if(!empty($characters))" the title "Characters" appear, thus proving that the injection itself loads. I've made sure my account have plenty of characters but still the "Characters" does not appear when viewing characters.
So my quess is that the query is faulty or perhaps my database. Any ideas?
Code:
<?PHP
// Reject any unwanted access.
if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
$player = $GLOBALS['player'];
$config = $GLOBALS['config'];
$SQL = POT::getInstance()->getDBHandle();
$characters = $SQL->query( 'SELECT `c`.`name`, `c`.`vocation`, `c`.`world_id` FROM `players` AS `c` LEFT JOIN `players` AS `p` ON `p`.`account_id` = `c`.`account_id` AND c.deleted = 0 AND c.hide_char = 0 AND p.hide_char = 0 WHERE `p`.`id` = '.$player->getId( ).' AND `c`.`id` != '.$player->getId( ).';' )->fetchAll();
if(!empty($characters))
echo '<div class="title">Characters</div>';
foreach( $characters as $character )
{
?>
<table style="width: 100%;">
<tr>
<td style="width: 40%;"><a href="<?PHP echo WEBSITE; ?>/index.php/character/view/<?PHP echo $character['name']; ?>"><b><?PHP echo $character['name']; ?></b></a></td>
</tr>
</table>
<br />
<?PHP
}
?>
I have also tried this code without success.
Code:
<?PHP
// Reject any unwanted access.
if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
$player = $GLOBALS['player'];
$config = $GLOBALS['config'];
$SQL = POT::getInstance()->getDBHandle();
$characters = $SQL->query( 'SELECT `c`.`name`, `c`.`vocation`, `c`.`world_id` FROM `players` AS `c` LEFT JOIN `players` AS `p` ON `p`.`account_id` = `c`.`account_id` AND c.deleted = 0 AND c.hide_char = 0 AND p.hide_char = 0 WHERE `p`.`id` = '.$player->getId( ).' AND `c`.`id` != '.$player->getId( ).';' )->fetchAll();
if(!empty($characters))
echo '<div class="bar">Characters</div>';
foreach( $characters as $character )
{
?>
<table style="width: 100%;">
<tr>
<td style="width: 40%;"><?PHP echo $character['name']; ?></td>
<td style="width: 25%;"><?PHP echo $config['server_vocations'][$character['vocation']]; ?></td>
<td style="width: 25%;"><?PHP echo $config['worlds'][$character['world_id']]; ?></td>
<td style="width: 10%;"><a href="<?PHP echo WEBSITE; ?>/index.php/character/view/<?PHP echo $character['name']; ?>"><strong>View</strong></a></td>
</tr>
</table>
<?PHP
}
?>
Last edited: