Array echo from given values

Hello guys. I’m new in php and kind of a newbie. I am trying to order some result taken from one database by a value with an array function. let me make it a little more clear by posting the code

i have a file called player_info.php and another one called functions.php. they are related so info is taken from functions and used in player_info

in player_info i take some result from the database and also from functions when echo-ing
[php]
include("./include/header.php");

$SteamID = $_GET["steamid"];

if($SteamID == NULL )
	$SteamID = $_POST["steamid"];


$Name = $_GET["name"];

if($Name == NULL )
	$Name = $_POST["name"];

$bValid = IsValidSteamID( $SteamID );


$bFoundPlayer = false;
$NumResults = 0;

if(bValid)
{
	// get the mysql
	$link = GetConnection($host, $username, $pass, $dbname, $name);
	$query = "SELECT * FROM $tbname WHERE steamid='$SteamID' OR name='$Name'";
	$result = GetResult($query);
	$NumResults = mysql_numrows($result);	
}

?>



  <p align="center"><strong><font size="3">
	<?php

		if(!bValid)
		{
			echo 'You have entered or searched for a player using an invalid Steam ID.';
			echo '<br />Please correct the error and try again.';
			echo "<br /><a href='index.php'><img src='images/backbutton.png' height='50px' /></a>";
			$NumResults = 0;
		}
		else
		{

			if( $NumResults != 0 )
			{

				$Name = mysql_result($result, 0, "name");
				$xp = mysql_result($result, 0, "xp");
				$SteamID = mysql_result($result, 0, "steamid");
				$level = GetPlayerLevel($xp);
				$xpNextlevel = GetXPForNextLevel($level+1);
				$xpDiff = GetXPDifference($xp, $xpNextlevel);
				$rank = GetPlayerRank($level);

				echo "<a href='index.php'><img src='images/backbutton.png' height='50px' /></a><br />";

… an entire page here to show the result, everything working fine…

<?php

	for($i = 0; $i + 32 <= sizeof($Skills["Name"] ) -1; $i++) 
	{
		$j = $i + 32;

		$ii = $i + 1;
		$jj = $j + 1;

//counting 01,02 …09 - including 0 in front of number to maintain alignment
$ii2 = $i + 1;
$jj2 = $j + 1;
if($ii2 < 10){
$ii2 = “0”.$ii2; }
if($jj2 < 10){
$jj2 = “0”.$jj2; }
//end of declaring counting with 0. variables are ii2 and jj2

//using if statement to show the rows including even numbers with one background and
//odd numbers with another. echo function to show what you want
if ($ii % 2 && $jj % 2) {
echo ’


’ . $ii2 .’. ’ . $Skills[“Name”][$i] . ‘: ’ . mysql_result($result, 0,‘skill’ . $ii) . ‘/’ . $Skills[“MaxPoints”][$i] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$i] . ’

’ . $jj2 .’. ’ . $Skills[“Name”][$j] . ': ’ . mysql_result($result, 0,‘skill’ . $jj) . ‘/’ . $Skills[“MaxPoints”][$j] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$j] . ’

‘;
}
else
{
echo ’
’ . $ii2 .’. ’ . $Skills[“Name”][$i] . ‘: ’ . mysql_result($result, 0,‘skill’ . $ii) . ‘/’ . $Skills[“MaxPoints”][$i] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$i] . ’

’ . $jj2 .’. ’ . $Skills[“Name”][$j] . ': ’ . mysql_result($result, 0,‘skill’ . $jj) . ‘/’ . $Skills[“MaxPoints”][$j] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$j] . ’

';}
//end of if condition and echo.
	}
}

?>

[/php]

the other document functions.php i extract these info
[php] $Skills = array(“Name” => array(“Vampiric Aura”, “Levitation”, “Devotion Aura”, “Equipment Reincarnation”, “Healing Wave”, “Siphon Mana”,
“Impale”, “Leather Skin”, “Unholy Aura”, “Bash”, “Critical Strike”, “Repair Armor”, “Banish”, “Hex”, “Spiked Carapace”, “Mend Wounds”,
“Evasion”, “True Shot Aura”, “Steel Skin”, “Carrion Beetles”, “Shadow Strike”, “Entangle Roots”, “Flame Strike”, “Dispell Hex”,
“Critical Grenade”, “Serpent Ward”, “Thorns Aura”, “Invisibility”, “Teleport”, “Big Bad Voodoo”, “Fan of Knives”, “Vengeance” ,
“Siphon Ammo”, “Blink”, “Phoenix”, “Napalm Grenade”, “Gate”, “Suicide Bomber”, “Chain Lightning”, “Decoy”, “Jump Kick”, “Multi Jump”,
“WindWalker”, “Rot”, “Syv Shield”, “Depower”, “Cloak of the chameleon”, “Cripple”, “Total Blindness”, “Locust Swarm”, “Disorient”,
“Endless Ammo”, “Earth Quake”, “Smite”, “Cluster Grenade”, “Ice Grenade”, “Helm Splitter”, “Hook Shot”, “Grab”, “Ninja Rope”,
“Fatal Strike”, “Blessing”, “Clay more Mine”, “Unfinished Skill”),

	"MaxPoints" =>  array(8,5,6,3,3,3,6,6,6,6,8,1,6,6,6,3,7,8,1,6,6,1,1,1,6,3,8,6,1,1,3,1,3,6,5,1,2,1,1,1,3,4,1,5,5,1,5,1,1,3,1,1,3,1,4,3,1,4,6,4,5,1,1,0),

	"MinLevel" =>  array(6,1,1,1,3,2,1,4,16,10,18,7,11,8,6,7,37,33,19,17,26,30,28,13,20,10,21,24,15,23,31,25,14,22,22,25,28,29,27,22,12,5,27,35,36,21,8,34,9,25,45,11,42,40,28,29,16,32,39,9,38,31,21,100)
	
		);

[/php]

what my problem exactly is… from the first php… at this echo:
[php]//using if statement to show the rows including even numbers with one background and
//odd numbers with another. echo function to show what you want
if ($ii % 2 && $jj % 2) {
echo ’


’ . $ii2 .’. ’ . $Skills[“Name”][$i] . ‘: ’ . mysql_result($result, 0,‘skill’ . $ii) . ‘/’ . $Skills[“MaxPoints”][$i] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$i] . ’

’ . $jj2 .’. ’ . $Skills[“Name”][$j] . ': ’ . mysql_result($result, 0,‘skill’ . $jj) . ‘/’ . $Skills[“MaxPoints”][$j] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$j] . ’

‘;
}
else
{
echo ’
’ . $ii2 .’. ’ . $Skills[“Name”][$i] . ‘: ’ . mysql_result($result, 0,‘skill’ . $ii) . ‘/’ . $Skills[“MaxPoints”][$i] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$i] . ’

’ . $jj2 .’. ’ . $Skills[“Name”][$j] . ': ’ . mysql_result($result, 0,‘skill’ . $jj) . ‘/’ . $Skills[“MaxPoints”][$j] . ’
Enabled at Level: ’ . $Skills[“MinLevel”][$j] . ’

';}
//end of if condition and echo.[/php]

It takes the MaxPoints well, MinLevel as well. I want to arrange the results in the echo by MinLevel but i have no clue how to do that… The result from the database come like this. Skill1 is first from Name has first number from MaxPoints and from MinLevel as well. I want theese to remain like that but only the echo to be by MinLevel.

Check the website to see what i have

http://uwc3x.stormzone.ro/xp-status-uWc3X/player_info.php?steamid=STEAM_0:1:25510570

Sponsor our Newsletter | Privacy Policy | Terms of Service