Hi people, someone know how put in the website a top to see Players on, her level and her clan? i already have one to see top pvp, pk, adena, castle etc...
You just need to learn some php and sql queries bro, then you can do this stuff yourself instead of digging around trying to find a solution
Code: <? include_once "config.php"; // db class & connection $db = new db(1); // do_query return an array with the required data $playerlist = $db->do_query(" SELECT TOP 10 char_name as Char,lev as Level,name as Clan, (CASE WHEN ((login>logout) OR (login IS NOT NULL AND logout IS NULL)) then 'On' else 'Off' end) as [On] FROM user_data LEFT JOIN pledge ON pledge.pledge_id = user_data.pledge_id WHERE builder = 0 AND account_id > 0 ORDER BY exp DESC "); // printing array in a table echo "<table width='400' cellspading='0' cellspacing='0' border='1'><tr>"; // printing field names foreach($playerlist[0] as $f=>$d) { echo "<td><b>$f</b></td>"; } echo "</tr>"; // printing field data foreach($playerlist as $pl) { echo "<tr>"; foreach($pl as $f=>$d) echo "<td>$d</td>"; echo "</tr>"; } echo "</table>"; ?>
i put my own connection and nothing :S u can put here ur config.php? coz i did everything and don't work :S
Well... extracted from my db class just the needed code to make this work, so final code will be something like this: Code: <? // db config $dbaddress = "127.0.0.1"; $dbuser = "dbuser"; $dbpass = "dbpass"; $worlddbname = "lin2world"; // db connection mssql_connect($dbaddress,$dbuser,$dbpass); mssql_select_db($worlddbname); // function to return an array with the required data function do_query($query) { $arr = array(); $result = @mssql_query($query); for ($x=0; $arr[$x] = @mssql_fetch_assoc($result); $x++); unset($arr[count($arr)-1]); return $arr; } $playerlist = do_query(" SELECT TOP 10 char_name as Char,lev as Level,name as Clan, (CASE WHEN ((login>logout) OR (login IS NOT NULL AND logout IS NULL)) then 'On' else 'Off' end) as [On] FROM user_data LEFT JOIN pledge ON pledge.pledge_id = user_data.pledge_id WHERE builder = 0 AND account_id > 0 ORDER BY exp DESC "); // printing array in a table echo "<table width='400' cellspading='0' cellspacing='0' border='1'><tr>"; // printing field names foreach($playerlist[0] as $f=>$d) { echo "<td><b>$f</b></td>"; } echo "</tr>"; // printing field data foreach($playerlist as $pl) { echo "<tr>"; foreach($pl as $f=>$d) echo "<td>$d</td>"; echo "</tr>"; } echo "</table>"; ?> Now yes, it's ready to use, i was hoping maybe i can make you try to learn a bit of php.. just a bit..