Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 150
Location: West Midlands. United Kingdom

PostPosted: Sat May 26, 2007 4:06 am Reply with quote

Hi all

I am created a block to show the top 10 players, I can get the information from the database to show, But, when I view the block the information is outside the block. Not too sure where I have gone wrong.

You can view it here: Only registered users can see links on this board! Get registered or login!

Its towards the bottom.

Any advise

Scorp
 
View user's profile Send private message Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Sun May 27, 2007 8:50 pm Reply with quote

Please post a link to the source code.
 
View user's profile Send private message
scorpious
PostPosted: Mon May 28, 2007 2:54 am Reply with quote

Hi Raven

Here is the code I have so far, How can I place the data results within the block under the headings?
Code:
<?php


if (eregi("block-toptenplayers.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

global $prefix, $db;
   
$result = $db->sql_query('SELECT playerID, kills, deaths FROM players ORDER BY kills DESC LIMIT 10');
  $content = '';
$content .= '<table><tr><td>Top 10 Players</td></tr></table>';

$content .= '<table><tr><td width="163">Players Name</td><td width="86">Kills</td><td width="82">Deaths</td><td width="86">Skill</td><td>Games</td></tr></table>';

// Place data under headings, this is the part I am not to sure of.

 echo "<table align=center>
   <tr>
  <td>Top 10 Players</td>
  </tr>

   <tr>
       
    </tr>";

//fetch tha data from the database
 while ($row = mysql_fetch_array($result)) {
    echo "
    <tr>
        <td>" . $row['playerID'] . "</td>
        <td>" . $row[''] . "</td>
        <td>" . $row['kills'] . " </td>
                <td>" . $row[''] . "</td>
        <td>" . $row['deaths'] . "</td>
    </tr>";
 }

echo "</table>";

?>


Cheers

Scorp
 
Raven
PostPosted: Mon May 28, 2007 8:07 am Reply with quote

All block content must be in the $content variable and the system will then echo $content. Instead of using echo you need to add the data to the $content variable.
Code:
// Place data under headings, this is the part I am not to sure of.


 $content .=  "<table align=center>
   <tr>
  <td>Top 10 Players</td>
  </tr>

   <tr>
       
    </tr>";

//fetch tha data from the database
 while ($row = mysql_fetch_array($result)) {
    $content .= "
    <tr>
        <td>" . $row['playerID'] . "</td>
        <td>" . $row[''] . "</td>
        <td>" . $row['kills'] . " </td>
                <td>" . $row[''] . "</td>
        <td>" . $row['deaths'] . "</td>
    </tr>";
 }

$content .= "</table>";
 
scorpious
PostPosted: Mon May 28, 2007 12:11 pm Reply with quote

Cheers Raven

Works like a charm


Scorp
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©