Jump to content
  • 0

DATA base php script help


Question

Posted

Hi I have the following script which was shared on mxc which is :

 

<?php

 

$dbuser="*";

$dbpass="*";

$dbname="l2jdb";  //the name of the database

$chandle = mysql_connect("*", $dbuser, $dbpass)

    or die("Connection Failure to Database");

mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found. " . $dbuser);

$sql="select characters.char_name,characters.pvpkills,char_templates.ClassName,characters.online,characters.accesslevel from characters,char_templates where characters.classid=char_templates.Classid order by characters.pvpkills DESC LIMIT 10";

echo"<html><head></head><body bgcolor='#2E1000' style='color:rgb(200,200,200)'>";

echo "<table  border='2' align=center width=440>";

echo "<tr><th>Nr</th><th>Name</th><th>PvP Kills</th><th>Main class</th><th>Status</th><th>Clan</th></tr>";

if ($result=mysql_query($sql)or die("Bed Sql syntax")) {

  $nr=1;

while ($row=mysql_fetch_row($result)) {

echo "<tr><td align=center>".$nr."</td>";

$nr++;

    echo "<td align=center>".$row[0]."</td>";

    echo "<td align=center>".$row[1]."</td>";

echo "<td align=center>".$row[2]."</td>";

if($row[4]==0)

{

if($row[3])

{echo "<td align=center style='color:rgb(0,255,0)'>Online</td>"; }

else{echo "<td align=center style='color:rgb(255,0,0)'>Offline</td>";}

}

else{echo "<td align=center style='color:rgb(255,0,0)'>Hidden</td>";}

 

$sql2= 'select clan_data.clan_name,characters.clanid from clan_data,characters where clan_data.clan_id = characters.clanid and characters.char_name like \''.$row[0].'\';';

$r=mysql_query($sql2)or die(mysql_error());

$row2=mysql_fetch_row($r);

if($row2[1]==0)

{echo "<td align=center style='color:rgb(255,0,0)'>Clan Less</td></tr>";

}else{echo "<td align=center style='color:rgb(255,0,0)'>".$row2[0]."</td></tr>";}

}

}else{ echo "<!-- SQL Error ".mysql_error()." -->";}

 

echo "</table>

 

<br>

 

</body></html>";

 

The problem I have is the GM's show up on the list. Can someone help me so the list doesnt include GM's

 

Thnx

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.


×
×
  • Create New...