Page 2 of 2

Re: [SHARE] Top Adena PHP script

Posted: Fri Jan 21, 2011 2:08 pm
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

Re: [SHARE] Top Adena PHP script

Posted: Sun Jan 23, 2011 2:31 am
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

Re: [SHARE] Top Adena PHP script

Posted: Tue Jan 25, 2011 9:51 pm
by pinkcore
Thanks you very much. Of course it is working - I'm using it too. :P ;)