<?php
// Server Database Config
$db_host = '1.1.1.1';
$db_user = 'user';
$db_pass = 'pass';
$db_database = 'l2jgs';
// Try to make connection.
$connection = new PDO("mysql:host=$db_host;dbname=$db_database;charset=utf8", $db_user, $db_pass);
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$class_name = array(
'88' => "Duelist",
'89' => "Dread Nought",
'90' => "Phoenix Knight",
'91' => "Hell Knight",
'92' => "Sagittarius",
'93' => "Adventurer",
'94' => "Archmage",
'95' => "Soul Taker",
'96' => "Arcane Lord",
'97' => "Cardinal",
'98' => "Hierophant",
'99' => "Evas Templar",
'100' => "Sword Muse",
'101' => "Wind Rider",
'102' => "Moonlight Sentinel",
'103' => "Mystic Muse",
'104' => "Elemental Master",
'105' => "Evas Saint",
'106' => "Shillien Templar",
'107' => "Spectral Dancer",
'108' => "Ghost Hunter",
'109' => "Ghost Sentinel",
'110' => "storm Screamer",
'111' => "Spectral Master",
'112' => "Shillien Saint",
'113' => "Titan",
'114' => "Grand Khauatari",
'115' => "Dominator",
'116' => "Doomcryer",
'117' => "Fortune Seeker",
'118' => "Maestro",
);
// Get data from heroes and character table
$character_row = $connection->prepare('SELECT heroes.charId, heroes.class_id, characters.char_name FROM heroes , characters WHERE heroes.charId = characters.charId ');
echo '<b>Hero list</b><br>';
echo '<table>';
if ($character_row->execute())
{
while ($row = $character_row->fetch(PDO::FETCH_ASSOC))
{
echo '<tr><td>', $row['char_name'],'</td><td>', $class_name[$row['class_id']], '</td></tr>' ;
}
}
echo '</table>';
$connection = null;
?>