Forum Moderators: coopster
i got a small problem and i dont know where to fix it
it works but it just give me the wrong value (it shows 1 instead of the name )
here is the script
<body bgcolor="#202020"><div align="center">
<font color="#202020">
<?php
$myhost="#*$!";
$mypass="#*$!";
$myuser="#*$!";
$mydb="#*$!";
mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($mydb);?></strong></font><b><font color="#FFFFFF" face="Andreas Pen MF" size="4"><marquee width="433" behavior="alternate">Top 10 Money Bags by E.M.E</marquee></font></b></p>
<p align="center">
<table width="50%" height="25" border="1" bgcolor="#800000" bordercolor="#FF00FF">
<tr>
<td width="57" bgcolor="#FF0000" bordercolor="#FF00FF">
<font color="#FFFFFF" face="Aniron" size="1">
<p align="center">
<strong style="font-weight: 400">Rank</strong></font></td>
<td width="129" bgcolor="#FF0000" bordercolor="#FF00FF">
<p align="center">
<font color="#FFFFFF" face="Aniron" size="1">
<strong style="font-weight: 400">Player Name</strong></font></p></td>
<td width="57" bgcolor="#FF0000" bordercolor="#FF00FF">
<font color="#FFFFFF" face="Aniron" size="1">
<p align="center">
<strong style="font-weight: 400">Level</strong></font></td>
<td width="108" bgcolor="#FF0000" bordercolor="#FF00FF">
<font color="#FFFFFF" face="Aniron" size="1">
<p style="padding-left: 11px;" align="center">
<strong style="font-weight: 400">Profession</strong></span></font></td>
<td width="108" bgcolor="#FF0000" bordercolor="#FF00FF">
<p align="center">
<font color="#FFFFFF" face="Aniron" size="1">
<strong style="font-weight: 400">EPs</strong></font></td>
<td width="114" bgcolor="#FF0000" bordercolor="#FF00FF">
<p align="center">
<font color="#FFFFFF" face="Aniron" size="1">
<strong style="font-weight: 400">Money Saved</strong></font></td>
<td width="114" bgcolor="#FF0000" bordercolor="#FF00FF">
<p align="center">
<font color="#FFFFFF" face="Aniron" size="1">
<strong style="font-weight: 400">legion</strong></font></td>
</tr>
<?php
$legions = mysql_query("SELECT NAME,id,leader_name,money,amount FROM cq_syndicate ORDER by id desc limit 5");
$guilds = mysql_query("SELECT syn_id FROM cq_synattr ORDER by syn_id limit 5");
$rank = mysql_query("SELECT NAME,level,profession,emoney,money_saved FROM cq_user ORDER by emoney desc limit 100");
//$row = mysql_fetch_array($rank);
$i=1;
while($row = mysql_fetch_array($rank)){
while($row1 = mysql_fetch_array($guilds));
while($row2 = mysql_fetch_array($legions));
$legion = ($row2[id] == $row1[syn_id] = $row2[NAME]);
if($row['profession']==20)
{
$profession='warrior';
}
else if($row['profession']==30)
{
$profession='Paladin';
}
else if($row['profession']==10)
{
$profession='mage';
}
echo '
<td><font color="#FFFFFF"><div align="center">'.$i.'</td>
<td><font color="#FFFFFF"><div align="center">'.$row['NAME'].'</td>
<td><font color="#FFFFFF"><div align="center">'.$row['level'].'</td>
<td><font color="#FFFFFF"><div align="center">'.$profession.'</td>
<td><font color="#FFFFFF"><div align="center">'.$row['emoney'].'</td>
<td><font color="#FFFFFF"><div align="center">'.$row['money_saved'].'</td>
<td><font color="#FFFFFF"><div align="center">'.$legion.'</td>
</tr> ';
$i=$i+1;
}
?>
</div>
now i goin explain what it normal need to do
row1[id] got a number that is the same as in row2[syn_id]
but it are just numbers and not names , so the names are stored in row2[NAME]
the point i try to get is that if the 2 value's are a match that it shows the name that is the same of the number instead of the number
so far is the script working exept that it shows number 1 instead of number 1321 (thats the first number in db :S )
i hope some1 can help me whit it :)
Greets From The Crasher
[edited by: eelixduppy at 5:26 pm (utc) on Oct. 5, 2008]
[edit reason] no URLs [/edit]
i got the script so far working that it gives a value
i goin show the latest script i use now (latest update)
<?php
$legions = mysql_query("SELECT NAME,id,leader_name,money,amount FROM cq_syndicate ORDER by id desc limit 10"); //edit
$guilds = mysql_query("SELECT syn_id FROM cq_synattr ORDER by syn_id limit 10");//edit
$rank = mysql_query("SELECT NAME,level,profession,emoney,money_saved FROM cq_user ORDER by emoney desc limit 10");
//$row = mysql_fetch_array($rank);
$i=1;
while($row = mysql_fetch_array($rank)){
while($row1 = mysql_fetch_array($guilds)); //edit
while($row2 = mysql_fetch_array($legions)); //edit
//$legion = ($row2['id'] == $row1['syn_id'] = $row2['NAME']); // my edit
$legion =($row2['id'] != $row1['syn_id']) ? $row2['NAME'] : 'no legion'; //last solution
the thing i try to do is to get $row1 the id from it ( a number) , then the same from $row2 , and then if they match then they need to show a name of the legion ( $row2['NAME')
i got it so far working that it says ' no legion' but it doesnt do what it need to do :S
so i think that the problem is in
$legion =($row2['id'] != $row1['syn_id']) ? $row2['NAME'] : 'no legion';
@ eelixduppy
sorry for the links
Greets From The crasher