Alittle prob

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Alittle prob
Azrael
CZ Newbie
Azrael has been a member for over 20 year's 20 Year Member
Website:
Status: Offline
Joined: Jun 06, 2004
0.00 posts per day
Posts: 6
Points: 941
   
Hi guys, i didn;t notice a forum for normal php scripting so please accept my apologies if this is the wrong forum as this is a NON NUKE question.

i have babstats which is a stats tracker for an online game called delta force, it tracks various stats like kills, deaths, knife kills, ect (a vast amount). It's a php program that uses mysql to store all the data in different tables. I am trying build a top 10 list with the players names and the amount of murders they have had listed from top to bottom, the player with the most murders at the top (using murders as an example) everything is working fine except one thing..........the script does the list as it should with the players name being a link to there stats within babstats, but the name appears as it does in the database which is some sort of coding...........i require the name to display the players name. i am trying to pull data from 2 tables, 1 has the players name and id and the other has various stats, the only relation to link the 2 tables is the player id.

you can see the script in action at this link: [ Register or login to view links on this board. ]

and heres the script:

<?php

// Database settings
$dbhost     = "localhost";   // Database host
$dbname     = "******";   // Database name
$dbusername = "******";      // Database user name
$dbuserpw   = "******";         // Database password

$link_id = mysql_connect($dbhost,$dbusername,$dbuserpw)
or die("Could not connect to MySQL.");
//echo("Connection Successfull.<br>");
$selected = mysql_select_db($dbname,$link_id)
or die("Could not select database");
//echo("Selection Successfull.");

$statURL = "/stats/"; // Please include the trailing slash /
$result = mysql_query("SELECT player, murders FROM chronos_stats WHERE 1 ORDER BY `murders` DESC LIMIT 0, 10");
while ($a_row = mysql_fetch_row($result ) ) {
$resultR2 = mysql_query("SELECT name, id, rating FROM `chronos_players`where id =$a_row[0]" );
while ($a_rowR2 = mysql_fetch_row($resultR2 ) ) {
$tnrn = $a_row[1] ;
$tnn = $a_rowR2[0] ;
}
$PlayerName = htmlspecialchars(base64_decode($a_rowR2[0]));
print "<table width=140>";
print "<tr>";
print "<td>";
$outputstat = "<a href=".$statURL."index.php?action=player_stats&id=".$a_row[0].">".$PlayerName."</td><td>$tnn $tnrn</td>";
print "</table>";
print $outputstat;
}
?>



i would really appreciate you're help in solving this problem


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
" which is some sort of coding " What are you reffering to is it a function to scramble the name? What does the name look like in the database? Can you post the function that sets the player name in the database?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Alittle prob
Azrael
CZ Newbie
Azrael has been a member for over 20 year's 20 Year Member
Website:
Status: Offline
Joined: Jun 06, 2004
0.00 posts per day
Posts: 6
Points: 941
   
thanks for the reply Telli,

what i mean is that the actual name for instance is "TDO DEMON" on the stats page, but in the database it is "VERPIERFTU9O"

if i just pull the names from the table on there own, i can list the names with this query "$PlayerName = htmlspecialchars(base64_decode( )); " changing the name from whats in the database to whats in the stats page. But for some reason, when i have the names pulled on the second query of the code above, that query doesn't do that. I have to have the table with the names as the second query due to sorting by most murders.

if it's any help, i can post a pic of both tables i'm pulling the data from?

thanks again.



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
$tnn = $a_rowR2[0] ;
}
$PlayerName = htmlspecialchars(base64_decode($a_rowR2[0]));
print "<table width=140>";
print "<tr>";
print "<td>";
$outputstat = "<a href=".$statURL."index.php?action=player_stats&id=".$a_row[0].">".$PlayerName."</td><td>$tnn $tnrn</td>";


$tnn is the player name? Try taking the ". from the PlayerName too.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: Alittle prob
Azrael
CZ Newbie
Azrael has been a member for over 20 year's 20 Year Member
Website:
Status: Offline
Joined: Jun 06, 2004
0.00 posts per day
Posts: 6
Points: 941
   
i got rid of the $tnn altogether and now it works, thanks Telli................i would never have got it, if you didn't mention that.


it's great to see someone taking the time to help us Newbies with there knowledge.
once again, many thanks

best regards
Azrael



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum