You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 174 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - League Leaders Block [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Beretta
Sergeant
Sergeant


Joined: Sep 30, 2005
Posts: 88

Location: Indiana USA

PostPosted: Mon Dec 18, 2006 10:11 pm Reply with quoteBack to top

How can i make this work in a block? Looks like seen here :
Http://truelegitballers.com on the right side
Code:

<?php
                   
                   
require('inc/connect.php');
require('inc/setting.php');



mysql_select_db("True2006",$db);

$mysql_query = "SELECT name as n, sum(points/gps) as ppg FROM nl_fullstats GROUP BY n ORDER BY ppg DESC LIMIT 5";

 $st = mysql_query($mysql_query, $db) or die(mysql_error());
$row_st = mysql_fetch_assoc($st);
$totalRows_st = mysql_num_rows($st);
?>
          </strong><strong> </strong></p>
        <div align="center">
          <table width="169" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#006699">
            <tr bgcolor="black">
              <td colspan="2"  align="left"><div align="center"><font size="3"><strong><span class="style3"><font color="red">POINTS</font></span></strong></font></div></td>
            </tr>
            <tr bgcolor="black">
              <td width="68%"  align="left" class="style1"><strong><font color="red" size="3">Name</font></strong></td>
              <td width="32%"  align="center"><strong><span class="style1"><font color="red" size="3">PPG</font></span></strong></td>
            </tr>
            <?php do { ?>
            <tr bgcolor="#FFFFFF">
              <td align="left"><font size="2"><strong><a href="<?PHP echo "http://www.truelegitballers.com/stats/player.php?name=".$row_st['n'].""; ?>"><?php echo $row_st['n']; ?></a></strong></font></td>
              <td align="center"><font size="2"><strong><?php echo round($row_st['ppg'],1); ?></strong></font></td>
            </tr>
            <?php } while ($row_st = mysql_fetch_assoc($st)); ?>
            <?php

mysql_select_db("True2006",$db);

$mysql_query = "SELECT name as n, sum(rebounds/gps) as rpg FROM nl_fullstats GROUP BY n ORDER BY rpg DESC LIMIT 5";

 $st = mysql_query($mysql_query, $db) or die(mysql_error());
$row_st = mysql_fetch_assoc($st);
$totalRows_st = mysql_num_rows($st);
?>
            <tr bgcolor="black">
              <td colspan="2"  align="left"><div align="center"><font size="3"><strong><span class="style3"><font color="red">REBOUNDS</font></span></strong></font></div></td>
            </tr>
            <tr bgcolor="black">
              <td width="68%"  align="left" class="style1"><strong><font color="red" size="3">Name</font></strong></td>
              <td width="32%"  align="center"><strong><span class="style1"><font color="red" size="3">RPG</font></span></strong></td>
            </tr>
            <?php do { ?>
            <tr bgcolor="#FFFFFF">
              <td align="left"><font size="2"><strong><a href="<?PHP echo "http://www.truelegitballers.com/stats/player.php?name=".$row_st['n'].""; ?>"><?php echo $row_st['n']; ?></a></strong></font></td>
              <td align="center"><font size="2"><strong><?php echo round($row_st['rpg'],1); ?></strong></font></td>
            </tr>
            <?php } while ($row_st = mysql_fetch_assoc($st)); ?>
            <?php

mysql_select_db("True2006",$db);

$mysql_query = "SELECT name as n, sum(assist/gps) as apg FROM nl_fullstats GROUP BY n ORDER BY apg DESC LIMIT 5";

 $st = mysql_query($mysql_query, $db) or die(mysql_error());
$row_st = mysql_fetch_assoc($st);
$totalRows_st = mysql_num_rows($st);
?>
            <tr bgcolor="black">
              <td colspan="2"  align="left"><div align="center"><font size="3"><strong><span class="style3"><font color="red">ASSISTS</font></span></strong></font></div></td>
            </tr>
            <tr bgcolor="black">
              <td width="68%"  align="left" class="style1"><strong><font color="red" size="3">Name</font></strong></td>
              <td width="32%"  align="center"><strong><span class="style1"><font color="red" size="3">APG</font></span></strong></td>
            </tr>
            <?php do { ?>
            <tr bgcolor="#FFFFFF">
              <td align="left"><font size="2"><strong><a href="<?PHP echo "http://www.truelegitballers.com/stats/player.php?name=".$row_st['n'].""; ?>"><?php echo $row_st['n']; ?></a></strong></font></td>
              <td align="center"><font size="2"><strong><?php echo round($row_st['apg'],1); ?></strong></font></td>
            </tr>
            <?php } while ($row_st = mysql_fetch_assoc($st)); ?>
            <?php

mysql_select_db("True2006",$db);

$mysql_query = "SELECT name as n, sum(block/gps) as bpg FROM nl_fullstats GROUP BY n ORDER BY bpg DESC LIMIT 5";

 $st = mysql_query($mysql_query, $db) or die(mysql_error());
$row_st = mysql_fetch_assoc($st);
$totalRows_st = mysql_num_rows($st);
?>
            <tr bgcolor="black">
              <td colspan="2"  align="left"><div align="center"><font size="3"><strong><span class="style3"><font color="red">BLOCKS</font></span></strong></font></div></td>
            </tr>
            <tr bgcolor="black">
              <td width="68%"  align="left" class="style1"><font color="red" size="3"><strong>Name</strong></font></td>
              <td width="32%"  align="center"><strong><span class="style1"><font color="red" size="3">BPG</font></span></strong></td>
            </tr>
            <?php do { ?>
            <tr bgcolor="#FFFFFF">
              <td align="left"><font size="2"><strong><a href="<?PHP echo "http://www.truelegitballers.com/stats/player.php?name=".$row_st['n'].""; ?>"><?php echo $row_st['n']; ?></a></strong></font></td>
              <td align="center"><font size="2"><strong><?php echo round($row_st['bpg'],1); ?></strong></font></td>
            </tr>
            <?php } while ($row_st = mysql_fetch_assoc($st)); ?>
          </table>
Find all posts by BerettaView user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Beretta
Sergeant
Sergeant


Joined: Sep 30, 2005
Posts: 88

Location: Indiana USA

PostPosted: Tue Dec 19, 2006 9:16 pm Reply with quoteBack to top

Damn no help?
Find all posts by BerettaView user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Tue Dec 19, 2006 9:42 pm Reply with quoteBack to top

Not sure what is in those include files that this may require. And the fact that it declares its own database connection, it would need to be converted to use phpNuke's database connection and abstraction layer. It would take some work to accomplish

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
Beretta
Sergeant
Sergeant


Joined: Sep 30, 2005
Posts: 88

Location: Indiana USA

PostPosted: Tue Dec 19, 2006 9:59 pm Reply with quoteBack to top

hmmm like how much work? all thats in includes file is db username and pw
Find all posts by BerettaView user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Fireboar
Corporal
Corporal


Joined: Dec 01, 2006
Posts: 64


PostPosted: Wed Dec 20, 2006 10:02 am Reply with quoteBack to top

Here's how:

Code:
<?php
                   
// Make sure people don't try and access it directly
if ( !defined('BLOCK_FILE') ) {
   die("Illegal Block File Access");
}

global $db;

// Firstly set up the table to start it off:
$content .= "          </strong><strong> </strong></p>\n        <div align=\"center\">\n          <table width=\"169\" border=\"1\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#006699\">\n";

// Now loop through each of the 4 categories because I'm too lazy to write out the same code 4 times and this way works just the same.
for ($i=1; $i<=4; $i++)
{
// What are we using? Set up the bits that change with each one:
if ($i = 1) {
  $contenttype = "POINTS";
  $contenttype_lower = "points";
  $abbr = "PPG";
  $abbr_lower = "ppg";
}
if ($i = 2) {
  $contenttype = "REBOUNDS";
  $contenttype_lower = "rebounds";
  $abbr = "RPG";
  $abbr_lower = "ppg";
}
if ($i = 3) {
  $contenttype = "ASSISTS";
  $contenttype_lower = "assist";
  $abbr = "APG";
  $abbr_lower = "ppg";
}
if ($i = 4) {
  $contenttype = "BLOCKS";
  $contenttype_lower = "block";
  $abbr = "BPG";
  $abbr_lower = "ppg";
}

// SQL query...
if (!$result = $db->sql_query("SELECT name as n, sum(".$contenttype_lower."/gps) as ".$abbr_lower." FROM nl_fullstats GROUP BY n ORDER BY ".$abbr_lower." DESC LIMIT 5")) die (mysql_error());

$totalRows = mysql_num_rows($result);

$content .= "            <tr bgcolor=\"black\">\n              <td colspan=\"2\"  align=\"left\"><div align=\"center\"><font size=\"3\"><strong><span class=\"style3\"><font color=\"red\">".$contenttype."</font></span></strong></font></div></td>\n            </tr>\n            <tr bgcolor=\"black\">\n              <td width=\"68%\"  align=\"left\" class=\"style1\"><strong><font color="red" size=\"3\">Name</font></strong></td>\n              <td width=\"32%\"  align=\"center\"><strong><span class=\"style1\"><font color=\"red\" size=\"3\">".$abbr."</font></span></strong></td>\n            </tr>";
$num = 0
while ($num < $totalRows)
{
$row = mysql_fetch_array($result);
$content .= "            <tr bgcolor=\"#FFFFFF\">\n              <td align=\"left\"><font size=\"2\"><strong><a href=\"http://www.truelegitballers.com/stats/player.php?name=".$row['n']."\">".$row['n']."</a></strong></font></td>\n              <td align=\"center\"><font size=\"2\"><strong>".round($row[$abbr_lower],1)."</strong></font></td>\n            </tr>\n";
}
}
$content .= "          </table>";
?>


That confusing (though not as long as the one we started with) stream of code should (if I haven't made any errors) come up with what you had there, only in block form. Save it as "blocks/block-Something" (replacing "Something" with whatever you want) and try it out, see if it'll work. On a side note, the database will have to be the same one as the phpnuke database.

_________________
http://www.fantasy-pc.com/ - PHP-Nuke website with a growing community where you can talk about anything.

Want a version of PHP-Nuke with all the bells and whistles removed? PHP-Nuke Lite is for you!
Find all posts by FireboarView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.206 Seconds - 167 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::