Php code for castles

If something doesn't fit in any other forum then post it here.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
papadkostas
Posts: 128
Joined: Fri Jul 02, 2010 8:34 am
Location: Greece
Contact:

Php code for castles

Post by papadkostas »

hello everybody
i did by my self the folowing to display on site castle status...but i got multiple times warning in page that
php Unable to jump to row 1 on MySQL result index X
here is the code
..if someone can see where is my own mistake and explain me how could i fix it would be great!!
and if my code is too big and its possible to be done the whole thing with less code dont kick my ass
yesterday i started learning about php :D
and thanks for you time :D

Code: Select all

<?php       include "./configs/mysql.php"; $connect = @mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword); @mysql_select_db($mySQLdefaultdb, $connect); if(!$connect) echo 'Can\'t connect to the database'; else $query = ("select id,name,taxPercent from castle order by id ");  $result = mysql_query($query) or die(mysql_error()); $i=1; while($row = mysql_fetch_array($result)){    if($i=="1")    {    $FORM .="<tr>                <th>Castle</th>                <th>Owner</th>                <th>Leader</th>                <th>Tax Rate</th>                </tr><br>";    }     $FORM .= "<tr>        <td>$row[1]</td>";                  $castle=$row[0];                $query2 = sprintf("select clan_name,leader_id from clan_data where hasCastle='%s'",mysql_real_escape_string($castle));          $result2 = mysql_query($query2) or die(mysql_error());                $clan = mysql_result($result2, 0);         if($tmp==NULL)            $FORM .= "<td>NPC</td>";        else                $FORM .= "<td>$clan</td>";                    $leader = mysql_result($result2, 1);                $query3 = sprintf("select char_name from characters where charid='%s'",mysql_real_escape_string($leader));          $result3 = mysql_query($query3) or die(mysql_error());                $leader = mysql_result($result3, 0);        if($leader==NULL)            $FORM .= "<td>None</td>";        else            $FORM .= "<td>$leader</td>";    $FORM .= "<td>$row[2]</td></tr>";    $i++;}    mysql_close();  ?>
I'm learning as fast..as roadrunner - Beeep Beeeep
Image
Post Reply