[SHARE] Top Adena PHP script

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
shamanidze
Posts: 9
Joined: Sat Dec 11, 2010 8:40 pm

Re: [SHARE] Top Adena PHP script

Post by shamanidze »

Read an item from the table(MySQL), and the cost of parsing the file(XML)
Extra work IMHO(in my humble opinion)
1.jpg
2.jpg
3.jpg
4.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
regenx
Posts: 319
Joined: Sat Jul 17, 2010 6:55 am

Re: [SHARE] Top Adena PHP script

Post by regenx »

pinkcore wrote:This PHP script will list richest people from server.
This script ignores all Admin / GMs characters as you can see (accessLevel = 0) in query. :)

First define your MySQL connection:

Code: Select all

 $db_link = mysql_connect('host', 'user', 'password');
And choose your database:

Code: Select all

$db_selected = mysql_select_db("database",$db_link);
Default script list only Top 10 players, if you want other number just change the limit at the end of query in $query_chars

Code: Select all

<?php$db_link = mysql_connect('host', 'user', 'password');    mysql_query("SET CHARACTER SET utf8");if (!$db_link) {    echo('Could not connect: ' . mysql_error());}$db_selected = mysql_select_db("database",$db_link);$FORM = "<table>    <tr>   <th align=center>Pos.</th>   <th width='175px' class='Stil5' align=center>Character</th>   <th width='150px' class='Stil5' align=center>Wealth</th>    </tr>"; $query_chars = "SELECT * FROM items INNER JOIN characters ON items.owner_id=characters.charId WHERE item_id=57 AND characters.accesslevel = 0 AND items.loc='INVENTORY' order by count desc limit 10"; $link = mysql_query($query_chars); $i=1; $r=255; while ( $row=mysql_fetch_array($link) ) {     $FORM .= "<tr>     <td align=center>$i</span></td>     <td align=center>$row[char_name]</td>     <td align=center>".number_format($row['count'])."</td>      </tr>";     $i++;     $r -= 0; }   echo $FORM;echo '</table>';?>
Credits goes to me :)
Enjoy! :P
Nice query :wink: and it's working...thx
User avatar
pinkcore
Posts: 247
Joined: Fri Jul 24, 2009 3:04 am
Location: Czech Republic

Re: [SHARE] Top Adena PHP script

Post by pinkcore »

Thanks you very much. Of course it is working - I'm using it too. :P ;)
I'm not here only for food!
Post Reply