Hello.
To start off with i know very little about php and mysql some but not enough to know enough to resolve problems of any kind.
Ok at the house here we have some individuals playing Lineage 2.
We wanted to set up our own fansite for the game as some of the data out on the web is a bit out dated with all the updates going on. That being said we have located one of the original database suppliers for the web for this game his name is duncan. He is sharing his data to anyone who wants to use it. Most of the web sites out on the web are useing his platform in one form or another. Though they have there own professional coders that are modifying the db or php pages to suit there own needs. That is all fine and good. I can understand why they will not share there codeing.
My problem is it seems that his php pages that he has supplied are for a different database other then mysql.
So how do i convert his php pages to use mysql instead of pg.
If i can get one page working i can get the others to do so. Also so can someone give me a hand in changing the php pages to use mysql there are two pages invloved one is the template page to connect to the db
the other is a page to view the data you want.
Below are the two pages first will be the page to connect to the db the will follow the other page
// Abilities:
// s_floating_target - Flying (extra damage from arrows)
// s_burning_wood - Plant (extra damage from fire/arrows?)
// s_unholy - Unholy/Undead (extra damage from holy)
// s_golem_body - Golem skin (reduced damage from arrows/daggers)
// s_soft_bones - Skeletal (extra damage from blunts)
// s_insect_skin - Insect property
// s_wind_feature - Wind property
// s_water_feature - Water property
// s_fire_feature - Fire property
// s_rg_ant_body - Royal Guard only body (not sure what it does)
// s_queen_ant_body - Queen ant only body (not sure what it does)
// s_full_magic_defence - Guessing NPC only, immune to magic
if ( !isset( $id ) )
{
if ( isset( $type ) && $type == 'unknown' )
{
$sql = "SELECT DISTINCT M.id, M.name, M.level, M.aggro, M.hp, M.mp,
M.exp, M.sp, M.npc, M.attack_range, N.title, N.name as name_lang
FROM Monsters as M
LEFT JOIN NpcNames as N
ON ( M.id = N.id AND N.language = '$l2dp_lang' )
WHERE ( M.npc IS NULL OR ( M.npc = 0 AND ( M.level IS NULL ) ) )
ORDER BY N.name;";
echo "<h3>Monsters - Unknown Level or NPC status</b></h3>";
}
elseif ( isset( $type ) && $type == 'undead' )
{
$sql = "SELECT DISTINCT M.id, M.name, M.level, M.aggro, M.hp, M.mp,
M.exp, M.sp, M.npc, M.attack_range, N.title, N.name as name_lang
FROM Monsters as M
LEFT JOIN NpcNames as N
ON ( M.id = N.id AND N.language = '$l2dp_lang' )
WHERE abilities LIKE '%s_unholy%'
ORDER BY level, N.name;";
echo "<h3>Monsters - Undead</b></h3>";
}
else
{
if ( !isset($hi) && !isset($lo) )
{
$lo = 1; $hi = 10;
}
$sql = "SELECT DISTINCT M.id, M.name, M.level, M.aggro, M.hp, M.mp,
M.exp, M.sp, M.npc, M.attack_range, N.title, N.name as name_lang
FROM Monsters as M
LEFT JOIN NpcNames as N
ON ( M.id = N.id AND N.language = '$l2dp_lang' )
WHERE M.level >= $lo AND M.level <= $hi AND M.npc = 0
ORDER BY level, N.name;";
$sql = "SELECT DISTINCT M.id, M.name, M.level, M.aggro, M.hp, M.mp,
M.exp, M.sp, M.phys_attack, M.phys_def, M.magic_attack, M.magic_def,
M.align, M.attack_range, N.name as name_lang
FROM Monsters AS M
LEFT JOIN NpcNames as N
ON ( M.id = N.id AND N.language = '$l2dp_lang' )
WHERE M.id = $id;";
$sql = "SELECT D.min, D.max, D.sweep, D.percentage, I.id, N.name
FROM Drops as D
JOIN Items as I
ON ( D.npc_id = $id AND I.id = D.item_id )
LEFT JOIN ItemNames as N
ON ( N.language = '$l2dp_lang' AND I.id = N.id )
ORDER BY D.sweep, D.percentage DESC;";
Bingo
I have no idea i tried this same thing and i got a parsing error on the second php page doh oh well i must have used a key that was wrong as my typing sucks and i didnt notice
Thank you so very much foryour reply
have a wonderful day and understand that someone loves you out in the world today LOL
Ok here is the page and it seems many pages are very similar so if we can get this to work maybe the others will be not so hard to do there are about 8 pages and near all of them are like this in form.
Im definatley getting errors regarding undefined variables or indexes relating to $class and $l2dp_lang'
If i delete them nothing happens as of the moment nothing will show on the page when accessed.
I know the database access page works L2DP.php as i have one page that is accessing the db with no problem.
$sql = "SELECT C.id, C.name AS c_name, parents, min_level, max_level,
S.name AS s_name
FROM Classes AS C, SysStrings as S
WHERE C.name = '$class' AND S.language = '$l2dp_lang' AND C.sys_id = S.id;";
$sql = "SELECT C.name AS c_name, S.name AS s_name
FROM Classes AS C, SysStrings as S
WHERE C.parents = '$tmp' AND S.language = '$l2dp_lang' AND C.sys_id = S.id
ORDER BY S.name;";
$ancestors = "";
if ( strlen( $class_info['parents'] ) > 0 )
{
$par = split( ";", $class_info['parents'] );
foreach ( $par as $p )
{
// lookup class_id
$sql = "SELECT id FROM Classes WHERE name = '$p';";
$result = mysql_query( $sql );
$lookup = mysql_fetch_array( $result );
$ancestors .= " OR class_id = " . $lookup['id'];
}
}
$sql = "
SELECT G.level AS g_level, G.sp_cost, S.id, S.icon,
S.level AS s_level, S.active, S.magic, S.mp_consume, S.hp_consume,
S.range, S.skill_time, S.reuse_delay, S.effect, S.magic_level,
N.name, N.description
FROM GainSkills as G
JOIN Skills as S
ON (
( G.class_id = $class_info[id]$ancestors )
AND G.level >= $class_info[min_level] AND G.level <= $class_info[max_level] AND G.skill_id = S.id
AND G.skill_level = S.level
)
LEFT JOIN SkillNames as N
ON ( S.id = N.id AND S.level = N.level AND N.language = '$l2dp_lang' )
ORDER BY G.level, S.active, N.name, S.level;";
As mentioned before, this code is pointless. There's also an error in the IF statement, where you should have a double "==" instead of a single "=". A single "=" will set the var to that value instead of testing the value, but either way the code does nothing useful.